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. Private Function

drain

Private Function
std.Io.Writer.Hashing.drain
fn drain(w: *Writer, data: []const []const u8, splat: usize) Error!usize

Params

  • w: *Writer
  • data: []const []const u8
  • splat: usize

Errors

WriteFailed

See the Writer implementation for detailed diagnostics.

File

Io/Writer.zig:2621
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
        fn drain(w: *Writer, data: []const []const u8, splat: usize) Error!usize {
            const this: *@This() = @alignCast(@fieldParentPtr("writer", w));
            this.hasher.update(w.buffered());
            w.end = 0;
            var n: usize = 0;
            for (data[0 .. data.len - 1]) |slice| {
                this.hasher.update(slice);
                n += slice.len;
            }
            for (0..splat) |_| this.hasher.update(data[data.len - 1]);
            return n + splat * data[data.len - 1].len;
        }