commit 2a2795b6c27b35408ae5d5a4357ad96ecca5c7b8
parent b9767b5e69245766f02618402acf37c0eb2f9ac8
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 7 Mar 2021 11:14:33 -0500
strio: add append_rune
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/strio/ops.ha b/strio/ops.ha
@@ -1,3 +1,4 @@
+use encoding::utf8;
use io;
use strings;
@@ -103,3 +104,7 @@ export fn rjoin(st: *io::stream, delim: str, strs: str...) (size | io::error) =
rjoin(st, "::", "foo") as size;
assert(string(st) == "foo");
};
+
+// Appends a rune to a stream.
+export fn append_rune(st: *io::stream, r: rune) (size | io::error) =
+ io::write(st, utf8::encode_rune(r));