Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

sendFile

Public Function
std.Io.Writer.sendFile
pub fn sendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize

Unlike writeSplat and writeVec, this function will call into VTable even if there is enough buffer capacity for the file contents.

The caller is responsible for flushing. Although the buffer may be bypassed as an optimization, this is not a guarantee.

Although it would be possible to eliminate error.Unimplemented from the error set by reading directly into the buffer in such case, this is not done because it is more efficient to do it higher up the call stack so that the error does not occur with each write.

See sendFileReading for an alternative that does not have error.Unimplemented in the error set.

Params

Errors

ReadFailed

Detailed diagnostics are found on the File.Reader struct.

WriteFailed

See the Writer implementation for detailed diagnostics.

EndOfStream

Reached the end of the file being read.

Unimplemented

Indicates the caller should do its own file reading; the callee cannot offer a more efficient implementation.

File

Io/Writer.zig:1022
1022
1023
1024
pub fn sendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize {
    return w.vtable.sendFile(w, file_reader, limit);
}