mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:44:43 +01:00
std.Io.File: add readStreaming
I resisted adding this because it's generally better to create a File.Reader instead, but we do need a simple wrapper around the vtable function, and there are use cases for it such as std.Progress.
This commit is contained in:
parent
f160d5f979
commit
28810f5e3d
1 changed files with 8 additions and 0 deletions
|
|
@ -499,6 +499,14 @@ pub fn setTimestampsNow(file: File, io: Io) SetTimestampsError!void {
|
|||
return io.vtable.fileSetTimestampsNow(io.userdata, file);
|
||||
}
|
||||
|
||||
/// Returns 0 on stream end or if `buffer` has no space available for data.
|
||||
///
|
||||
/// See also:
|
||||
/// * `reader`
|
||||
pub fn readStreaming(file: File, io: Io, buffer: []const []u8) Reader.Error!usize {
|
||||
return io.vtable.fileReadStreaming(io.userdata, file, buffer);
|
||||
}
|
||||
|
||||
pub const ReadPositionalError = Reader.Error || error{Unseekable};
|
||||
|
||||
/// Returns 0 on stream end or if `buffer` has no space available for data.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue