writeByteNTimes
Function parameters
Parameters
Type definitions in this namespace
Types
Functions in this namespace
Functions
- adaptToNewApi
- Helper for bridging to the new `Writer` API while upgrading.
Source
Implementation
pub fn writeByteNTimes(self: Self, byte: u8, n: usize) anyerror!void {
var bytes: [256]u8 = undefined;
@memset(bytes[0..], byte);
var remaining: usize = n;
while (remaining > 0) {
const to_write = @min(remaining, bytes.len);
try self.writeAll(bytes[0..to_write]);
remaining -= to_write;
}
}