commit 10f02df0935ff377ab4db8f3a344e999d92a39ff
parent 17123299b8c1e02c7965dfc8dc9b467c566ba3d7
Author: Bor Grošelj Simić <bgs@turminal.net>
Date: Thu, 11 Apr 2024 01:46:32 +0200
encoding::base64: document behavior after errors
References: https://todo.sr.ht/~sircmpwn/hare/820
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/encoding/base64/base64.ha b/encoding/base64/base64.ha
@@ -62,8 +62,9 @@ const encoder_vtable: io::vtable = io::vtable {
// Creates a stream that encodes writes as base64 before writing them to a
// secondary stream. Afterwards [[io::close]] must be called to write any
-// unwritten bytes, in case of padding. Closing this stream will not close
-// the underlying stream.
+// unwritten bytes, in case of padding. Closing this stream will not close the
+// underlying stream. After a write returns an error, the stream must not be
+// written to again or closed.
export fn newencoder(
enc: *encoding,
out: io::handle,
@@ -279,7 +280,8 @@ const decoder_vtable: io::vtable = io::vtable {
// Creates a stream that reads and decodes base 64 data from a secondary stream.
// This stream does not need to be closed, and closing it will not close the
-// underlying stream.
+// underlying stream. If a read returns an error, the stream must not be read
+// from again.
export fn newdecoder(
enc: *encoding,
in: io::handle,