commit 488fc64ea05aea780815ad39ddc9b9d085857ccf
parent 340e7867667a533abb173582f40016e544369e71
Author: Alexey Yerin <yyp@disroot.org>
Date: Wed, 27 Apr 2022 22:40:28 +0300
io: fix documentation for stream/vtable
They were previously swapped, which is a bit confusing.
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/io/stream.ha b/io/stream.ha
@@ -6,14 +6,10 @@ use errors;
// A stream is a pointer to a [[vtable]] which allows for user-defined I/O
// abstractions to implement some subset of read, write, seek, close, and other
-// I/O functionality in userspace.
-export type stream = *vtable;
-
-// The vtable type defines a set of virtual functions for a [[stream]]. To
-// create a custom stream type, embed
+// I/O functionality in userspace. Embed to create a custom stream type:
//
// export type my_stream = struct {
-// vtable: io::vtable,
+// vtable: io::stream,
// fd: int,
// };
//
@@ -35,6 +31,9 @@ export type stream = *vtable;
//
// let stream = open("example");
// io::read(&stream, buf)!;
+export type stream = *vtable;
+
+// The vtable type defines a set of virtual functions for a [[stream]].
export type vtable = struct {
reader: nullable *reader,
writer: nullable *writer,