Zig 0.17.0-dev (Split by item) 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.
std › Io › Dispatch › fileWriteStreaming Private Function fileWriteStreaming Doc Source Private Function std.Io.Dispatch.fileWriteStreaming
fn fileWriteStreaming (
ev : *Evented ,
file : File ,
header : []const u8 ,
data : []const []const u8 ,
splat : usize ,
) File .Writer .Error !usize Params ev : *Evented file : File header : []const u8 data : []const []const u8 splat : usize File Io/Dispatch.zig: 1782
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825 fn fileWriteStreaming (
ev : *Evented ,
file : File ,
header : []const u8 ,
data : []const []const u8 ,
splat : usize ,
) File .Writer .Error !usize {
if (file .flags .nonblocking ) nonblocking : {
return fileWriteStreamingLimit (
file .handle ,
header ,
data ,
splat ,
.unlimited ,
) catch |err | switch (err ) {
error .WouldBlock => break :nonblocking ,
else => |e | return e ,
};
}
const source = c .dispatch .source_create (
.WRITE ,
@bitCast (@as (isize , file .handle )),
.none ,
ev .queue ,
) orelse return error .SystemResources ;
source .as_object ().set_context (Thread .current ().currentFiber ());
source .set_event_handler (&Fiber .@"resume" );
ev .yield (.{ .activate = source .as_object () });
const limit = source .get_data ();
source .as_object ().release ();
while (true ) return fileWriteStreamingLimit (
file .handle ,
header ,
data ,
splat ,
.limited (limit ),
) catch |err | switch (err ) {
error .WouldBlock => {
ev .yield (.nothing );
continue ;
},
else => |e | return e ,
};
}