Function end [src]
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.
Prototype
pub fn end(w: *Writer) EndError!void Parameters
w: *Writer Possible Errors
The Operating System returned an undocumented error code.
This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.
When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.
Source
pub fn end(w: *Writer) EndError!void {
try w.interface.flush();
switch (w.mode) {
.positional,
.positional_reading,
=> w.file.setEndPos(w.pos) catch |err| switch (err) {
error.NonResizable => return,
else => |e| return e,
},
.streaming,
.streaming_reading,
.failure,
=> {},
}
}