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 library itself.

windowsWriteBuffer

Since Windows only supports writing one contiguous buffer, returns the first one, while also limiting it to a length representable by 32-bit unsigned integer.

Threaded.windowsWriteBuffer
fn windowsWriteBuffer(header: []const u8, data: []const []const u8, splat: usize) []const u8

File

lib/std/Io/Threaded.zig:3236

Code

fn windowsWriteBuffer(header: []const u8, data: []const []const u8, splat: usize) []const u8 {
    const buffer = b: {
        if (header.len != 0) break :b header;
        for (data[0 .. data.len - 1]) |buffer| {
            if (buffer.len != 0) break :b buffer;
        }
        if (splat == 0) return &.{};
        break :b data[data.len - 1];
    };
    return buffer[0..std.math.lossyCast(u32, buffer.len)];
}