Add "Reader" IO closure type for reading resources
This commit is contained in:
parent
b698f18c4d
commit
ccb96875b1
|
@ -98,6 +98,12 @@ pub const FileAccess = struct {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Closure that captures a reference to readable resources like block devices, memory buffers,
|
||||||
|
/// network sockets, and more.
|
||||||
|
///
|
||||||
|
pub const Reader = meta.Function(@sizeOf(usize), []u8, usize);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Returns a state machine for lazily computing all `Element` components of a given source input
|
/// Returns a state machine for lazily computing all `Element` components of a given source input
|
||||||
/// that match a delimiting pattern.
|
/// that match a delimiting pattern.
|
||||||
|
@ -238,9 +244,9 @@ test "Null writing" {
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Writes the singular `byte` to `writer`, returning `true` if it was successfully written,
|
/// Applies the singular `byte` to `writer`, returning `true` if it was successfully written,
|
||||||
/// otherwise `false`.
|
/// otherwise `false`.
|
||||||
///
|
///
|
||||||
pub fn writeByte(writer: Writer, byte: u8) bool {
|
pub fn writeByte(writer: *Writer, byte: u8) bool {
|
||||||
return (writer.apply(std.mem.asBytes(&byte)) != 0);
|
return (writer.apply(std.mem.asBytes(&byte)) != 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue