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

end

Public Function
std.Io.File.Writer.end
pub fn end(w: *Writer) EndError!void

Flushes any buffered data and sets the end position of the file.

If not overwriting existing contents, then calling interface.flush directly is sufficient.

Flush failure is handled by setting err so that it can be handled along with other write failures.

Params

File

Io/File/Writer.zig:237
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
pub fn end(w: *Writer) EndError!void {
    const io = w.io;
    try w.interface.flush();
    switch (w.mode) {
        .positional,
        .positional_simple,
        => w.file.setLength(io, w.pos) catch |err| switch (err) {
            error.NonResizable => return,
            else => |e| return e,
        },

        .streaming,
        .streaming_simple,
        .failure,
        => {},
    }
}