commit 6275c4fb84bbecddfe7098efed4843925dc3d48f
parent c7d752aa8f0cc9f6b22c084c85c01837741d89a6
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 19 Apr 2021 18:16:48 -0400
strio: improve docs
Diffstat:
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/strio/README b/strio/README
@@ -0,0 +1,5 @@
+strio provides string-related I/O operations, specifically to make efficient use
+of memory while building strings incrementally. The main entry points to strio
+are [[dynamic]] and [[fixed]]. Each of the utility functions (e.g.
+[[appendrune]]) work correctly with any [[io::stream]], but for efficiency
+reasons it is recommended that they are either a strio or [[bufio]] stream.
diff --git a/strio/ops.ha b/strio/ops.ha
@@ -3,8 +3,8 @@ use io;
use strings;
// Appends zero or more strings to an [[io::stream]]. The stream needn't be a
-// strio stream, but it's often efficient if it is. Returns the number of bytes
-// written, or an error.
+// strio stream, but it's generally more efficient if it is. Returns the number
+// of bytes written, or an error.
export fn concat(st: *io::stream, strs: str...) (size | io::error) = {
let n = 0z;
for (let i = 0z; i < len(strs); i += 1) {
@@ -28,8 +28,8 @@ export fn concat(st: *io::stream, strs: str...) (size | io::error) = {
};
// Joins several strings together by a delimiter and writes them to a stream.
-// The stream needn't be a strio stream, but it's often more efficient if it is.
-// Returns the number of bytes written, or an error.
+// The stream needn't be a strio stream, but it's generally more efficient if it
+// is. Returns the number of bytes written, or an error.
export fn join(st: *io::stream, delim: str, strs: str...) (size | io::error) = {
let n = 0z;
let delim = strings::toutf8(delim);
@@ -67,7 +67,7 @@ export fn join(st: *io::stream, delim: str, strs: str...) (size | io::error) = {
};
// Joins several strings together by a delimiter and writes them to a stream, in
-// reverse order. The stream needn't be a strio stream, but it's often more
+// reverse order. The stream needn't be a strio stream, but it's generally more
// efficient if it is. Returns the number of bytes written, or an error.
export fn rjoin(st: *io::stream, delim: str, strs: str...) (size | io::error) = {
let n = 0z;