Function discard [src]

Reads the stream until the end, ignoring all the data. Returns the number of bytes discarded.

Prototype

pub fn discard(self: Self) anyerror!u64

Parameters

self: Self

Source

pub fn discard(self: Self) anyerror!u64 { var trash: [4096]u8 = undefined; var index: u64 = 0; while (true) { const n = try self.read(&trash); if (n == 0) return index; index += n; } }