pub fn advance(w: *Writer, n: usize) void
After calling `writableSliceGreedy`, this function tracks how many bytes were written to it.
- Kind
- function
- Module
std.Io.Writer
pub fn alignBuffer(w: *Writer, buffer: []const u8, width: usize, alignment: std.fmt.Alignment, fill: u8) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn alignBufferOptions(w: *Writer, buffer: []const u8, options: std.fmt.Options) Error!void
- Kind
- function
- Module
std.Io.Writer
Maintains `Writer` state such that it writes to the unused capacity of an array list, filling it up completely before making a call through the vtable, causing a resize.
- Kind
- struct
- Module
std.Io.Writer
pub fn clearRetainingCapacity(a: *Allocating) void
- Kind
- function
- Module
std.Io.Writer
pub fn deinit(a: *Allocating) void
- Kind
- function
- Module
std.Io.Writer
pub fn ensureTotalCapacity(a: *Allocating, new_capacity: usize) Allocator.Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn ensureTotalCapacityPrecise(a: *Allocating, new_capacity: usize) Allocator.Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn ensureUnusedCapacity(a: *Allocating, additional_count: usize) Allocator.Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn fromArrayList(allocator: Allocator, array_list: *ArrayList(u8)) Allocating
Replaces `array_list` with empty, taking ownership of the memory.
- Kind
- function
- Module
std.Io.Writer
pub fn fromArrayListAligned(allocator: Allocator, comptime alignment: std.mem.Alignment, array_list: *std.array_list.Aligned(u8, alignment)) Allocating
Replaces `array_list` with empty, taking ownership of the memory.
- Kind
- function
- Module
std.Io.Writer
pub fn init(allocator: Allocator) Allocating
- Kind
- function
- Module
std.Io.Writer
pub fn initAligned(allocator: Allocator, alignment: std.mem.Alignment) Allocating
- Kind
- function
- Module
std.Io.Writer
pub fn initCapacity(allocator: Allocator, capacity: usize) error
- Kind
- function
- Module
std.Io.Writer
pub fn initOwnedSlice(allocator: Allocator, slice: []u8) Allocating
- Kind
- function
- Module
std.Io.Writer
pub fn initOwnedSliceAligned(allocator: Allocator, comptime alignment: std.mem.Alignment, slice: []align(alignment.toByteUnits()) u8) Allocating
- Kind
- function
- Module
std.Io.Writer
pub fn shrinkRetainingCapacity(a: *Allocating, new_len: usize) void
- Kind
- function
- Module
std.Io.Writer
pub fn toArrayList(a: *Allocating) ArrayList(u8)
Returns an array list that takes ownership of the allocated memory.
- Kind
- function
- Module
std.Io.Writer
pub fn toArrayListAligned(a: *Allocating, comptime alignment: std.mem.Alignment) std.array_list.Aligned(u8, alignment)
Returns an array list that takes ownership of the allocated memory.
- Kind
- function
- Module
std.Io.Writer
pub fn toOwnedSlice(a: *Allocating) Allocator.Error![]u8
- Kind
- function
- Module
std.Io.Writer
pub fn toOwnedSliceSentinel(a: *Allocating, comptime sentinel: u8) Allocator.Error![:sentinel]u8
- Kind
- function
- Module
std.Io.Writer
pub fn written(a: *Allocating) []u8
- Kind
- function
- Module
std.Io.Writer
pub fn buffered(w: *const Writer) []u8
Returns the contents not yet drained.
- Kind
- function
- Module
std.Io.Writer
- Kind
- enum
- Module
std.Io.Writer
pub fn consume(w: *Writer, n: usize) usize
Removes the first `n` bytes from `buffer` by shifting buffer contents, returning how many bytes are left after consuming the entire buffer, or zero if the entire buffer was not consumed.
- Kind
- function
- Module
std.Io.Writer
pub fn consumeAll(w: *Writer) usize
Shortcut for setting `end` to zero and returning zero.
- Kind
- function
- Module
std.Io.Writer
pub fn countSendFileLowerBound(n: usize, file_reader: *File.Reader, limit: Limit) ?usize
- Kind
- function
- Module
std.Io.Writer
pub fn countSplat(data: []const []const u8, splat: usize) usize
- Kind
- function
- Module
std.Io.Writer
pub fn defaultFlush(w: *Writer) Error!void
Repeatedly calls `VTable.drain` until `end` is zero.
- Kind
- function
- Module
std.Io.Writer
pub fn defaultRebase(w: *Writer, preserve: usize, minimum_len: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
- Kind
- struct
- Module
std.Io.Writer
pub fn drain(w: *Writer, data: []const []const u8, splat: usize) Error!usize
- Kind
- function
- Module
std.Io.Writer
pub fn fullCount(d: *const Discarding) u64
Includes buffered data (no need to flush).
- Kind
- function
- Module
std.Io.Writer
pub fn init(buffer: []u8) Discarding
- Kind
- function
- Module
std.Io.Writer
pub fn sendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize
- Kind
- function
- Module
std.Io.Writer
pub fn ensureUnusedCapacity(w: *Writer, n: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
- Kind
- error set
- Module
std.Io.Writer
- Kind
- constant
- Module
std.Io.Writer
pub fn failingDrain(w: *Writer, data: []const []const u8, splat: usize) Error!usize
- Kind
- function
- Module
std.Io.Writer
pub fn failingRebase(w: *Writer, preserve: usize, capacity: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn failingSendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize
- Kind
- function
- Module
std.Io.Writer
- Kind
- error set
- Module
std.Io.Writer
- Kind
- error set
- Module
std.Io.Writer
- Kind
- error set
- Module
std.Io.Writer
pub fn fixed(buffer: []u8) Writer
Writes to `buffer` and returns `error.WriteFailed` when it is full.
- Kind
- function
- Module
std.Io.Writer
pub fn fixedDrain(w: *Writer, data: []const []const u8, splat: usize) Error!usize
When this function is called it usually means the buffer got full, so it's time to return an error.
- Kind
- function
- Module
std.Io.Writer
pub fn flush(w: *Writer) Error!void
Drains all remaining buffered data.
- Kind
- function
- Module
std.Io.Writer
pub fn fromArrayList(array_list: *ArrayList(u8)) Writer
- Kind
- function
- Module
std.Io.Writer
pub fn Hashed(comptime Hasher: type) type
Provides a `Writer` implementation based on calling `Hasher.update`, sending all data also to an underlying `Writer`.
- Kind
- type function
- Module
std.Io.Writer
pub fn hashed(w: *Writer, hasher: anytype, buffer: []u8) Hashed(@TypeOf(hasher))
- Kind
- function
- Module
std.Io.Writer
pub fn init(out: *Writer, buffer: []u8) @This()
- Kind
- function
- Module
std.Io.Writer
pub fn initHasher(out: *Writer, hasher: Hasher, buffer: []u8) @This()
- Kind
- function
- Module
std.Io.Writer
pub fn Hashing(comptime Hasher: type) type
Provides a `Writer` implementation based on calling `Hasher.update`, discarding all data.
- Kind
- type function
- Module
std.Io.Writer
pub fn init(buffer: []u8) @This()
- Kind
- function
- Module
std.Io.Writer
pub fn initHasher(hasher: Hasher, buffer: []u8) @This()
- Kind
- function
- Module
std.Io.Writer
pub fn invalidFmtError(comptime fmt: []const u8, value: anytype) noreturn
- Kind
- function
- Module
std.Io.Writer
pub fn noopFlush(w: *Writer) Error!void
Does nothing.
- Kind
- function
- Module
std.Io.Writer
pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void
Renders `fmt` string with `args`, calling `w` with slices of bytes.
- Kind
- function
- Module
std.Io.Writer
pub fn printAddress(w: *Writer, value: anytype) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printArray(w: *Writer, comptime fmt: []const u8, options: std.fmt.Options, ptr_to_array: anytype, max_depth: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printAscii(w: *Writer, bytes: []const u8, options: std.fmt.Options) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printAsciiChar(w: *Writer, c: u8, options: std.fmt.Options) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printBase64(w: *Writer, bytes: []const u8) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printByteSize(w: *Writer, value: u64, comptime units: ByteSizeUnits, options: std.fmt.Options) Error!void
Format option `precision` is ignored when `value` is less than 1kB.
- Kind
- function
- Module
std.Io.Writer
pub fn printFloat(w: *Writer, value: anytype, options: std.fmt.Number) Error!void
Uses a larger stack buffer; asserts mode is decimal or scientific.
- Kind
- function
- Module
std.Io.Writer
pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precision: ?usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printFloatHexOptions(w: *Writer, value: anytype, options: std.fmt.Number) Error!void
Uses a smaller stack buffer; asserts mode is not decimal or scientific.
- Kind
- function
- Module
std.Io.Writer
pub fn printHex(w: *Writer, bytes: []const u8, case: std.fmt.Case) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printInt(w: *Writer, value: anytype, base: u8, case: std.fmt.Case, options: std.fmt.Options) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printIntAny(w: *Writer, value: anytype, base: u8, case: std.fmt.Case, options: std.fmt.Options) Error!void
In general, prefer `printInt` to avoid generic explosion.
- Kind
- function
- Module
std.Io.Writer
pub fn printStringEscaped(w: *Writer, bytes: []const u8) Error!void
Prints a double quote, then escapes a string according to Zig string literal rules, then a double quote.
- Kind
- function
- Module
std.Io.Writer
pub fn printUnicodeCodepoint(w: *Writer, c: u21) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printValue(w: *Writer, comptime fmt: []const u8, options: std.fmt.Options, value: anytype, max_depth: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn printVector(w: *Writer, comptime fmt: []const u8, options: std.fmt.Options, value: anytype, max_depth: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn rebase(w: *Writer, preserve: usize, unused_capacity_len: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn sendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize
Unlike `writeSplat` and `writeVec`, this function will call into `VTable` even if there is enough buffer capacity for the file contents.
- Kind
- function
- Module
std.Io.Writer
pub fn sendFileAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllError!usize
Number of bytes logically written is returned.
- Kind
- function
- Module
std.Io.Writer
pub fn sendFileReading(w: *Writer, file_reader: *File.Reader, limit: Limit) FileReadingError!usize
- Kind
- function
- Module
std.Io.Writer
pub fn sendFileReadingAll(w: *Writer, file_reader: *File.Reader, limit: Limit) FileAllError!usize
Equivalent to `sendFileAll` but uses direct `pread` and `read` calls on `file` rather than `sendFile`.
- Kind
- function
- Module
std.Io.Writer
pub fn splatByte(w: *Writer, byte: u8, n: usize) Error!usize
Writes the same byte many times, allowing short writes.
- Kind
- function
- Module
std.Io.Writer
pub fn splatByteAll(w: *Writer, byte: u8, n: usize) Error!void
Writes the same byte many times, performing the underlying write call as many times as necessary.
- Kind
- function
- Module
std.Io.Writer
pub fn splatBytePreserve(w: *Writer, preserve: usize, byte: u8, n: usize) Error!void
Writes the same byte many times, performing the underlying write call as many times as necessary.
- Kind
- function
- Module
std.Io.Writer
pub fn splatBytes(w: *Writer, bytes: []const u8, n: usize) Error!usize
Writes the same slice many times, allowing short writes.
- Kind
- function
- Module
std.Io.Writer
pub fn splatBytesAll(w: *Writer, bytes: []const u8, splat: usize) Error!void
Writes the same slice many times, performing the underlying write call as many times as necessary.
- Kind
- function
- Module
std.Io.Writer
pub fn toArrayList(w: *Writer) ArrayList(u8)
- Kind
- function
- Module
std.Io.Writer
pub fn undo(w: *Writer, n: usize) void
- Kind
- function
- Module
std.Io.Writer
pub fn unimplementedSendFile(w: *Writer, file_reader: *File.Reader, limit: Limit) FileError!usize
For use when the `Writer` implementation can cannot offer a more efficient implementation than a basic read/write loop on the file.
- Kind
- function
- Module
std.Io.Writer
pub fn unreachableDrain(w: *Writer, data: []const []const u8, splat: usize) Error!usize
- Kind
- function
- Module
std.Io.Writer
pub fn unreachableRebase(w: *Writer, preserve: usize, capacity: usize) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn unusedCapacityLen(w: *const Writer) usize
- Kind
- function
- Module
std.Io.Writer
pub fn unusedCapacitySlice(w: *const Writer) []u8
- Kind
- function
- Module
std.Io.Writer
- Kind
- struct
- Module
std.Io.Writer
pub fn writableArray(w: *Writer, comptime len: usize) Error!*[len]u8
- Kind
- function
- Module
std.Io.Writer
pub fn writableSlice(w: *Writer, len: usize) Error![]u8
- Kind
- function
- Module
std.Io.Writer
pub fn writableSliceGreedy(w: *Writer, minimum_len: usize) Error![]u8
- Kind
- function
- Module
std.Io.Writer
pub fn writableSliceGreedyPreserve(w: *Writer, preserve: usize, minimum_len: usize) Error![]u8
- Kind
- function
- Module
std.Io.Writer
pub fn writableSlicePreserve(w: *Writer, preserve: usize, len: usize) Error![]u8
- Kind
- function
- Module
std.Io.Writer
pub fn write(w: *Writer, bytes: []const u8) Error!usize
Transfers `bytes` to the stream, calling `drain` at most once.
- Kind
- function
- Module
std.Io.Writer
pub fn writeAll(w: *Writer, bytes: []const u8) Error!void
Transfers `bytes` to the stream, calling `drain` as many times as necessary such that all `bytes` are transferred.
- Kind
- function
- Module
std.Io.Writer
pub fn writeByte(w: *Writer, byte: u8) Error!void
Calls `drain` as many times as necessary such that `byte` is transferred.
- Kind
- function
- Module
std.Io.Writer
pub fn writeBytePreserve(w: *Writer, preserve: usize, byte: u8) Error!void
On success, at least `preserve` bytes will remain buffered if there are enough buffered bytes to do so.
- Kind
- function
- Module
std.Io.Writer
pub fn writeInt(w: *Writer, comptime T: type, value: T, endian: std.lang.Endian) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn writeLeb128(w: *Writer, value: anytype) Error!void
Write a single integer as LEB128 to the given writer.
- Kind
- function
- Module
std.Io.Writer
pub fn writeSleb128(w: *Writer, value: anytype) Error!void
Write a single signed integer as LEB128 to the given writer.
- Kind
- function
- Module
std.Io.Writer
pub fn writeSliceEndian(w: *Writer, Elem: type, slice: []const Elem, endian: std.lang.Endian) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn writeSliceSwap(w: *Writer, Elem: type, slice: []const Elem) Error!void
- Kind
- function
- Module
std.Io.Writer
pub fn writeSplat(w: *Writer, data: []const []const u8, splat: usize) Error!usize
If the number of bytes to write based on `data` and `splat` fits inside `unusedCapacitySlice`, this function is guaranteed to not fail, not call into `VTable`, and return the full number of bytes.
- Kind
- function
- Module
std.Io.Writer
pub fn writeSplatAll(w: *Writer, data: [][]const u8, splat: usize) Error!void
The `data` parameter is mutable because this function needs to mutate the fields in order to handle partial writes from `VTable.writeSplat`. `data` will be restored to its original state before returning.
- Kind
- function
- Module
std.Io.Writer
pub fn writeStruct(w: *Writer, value: anytype, endian: std.lang.Endian) Error!void
The function is inline to avoid the dead code in case `endian` is comptime-known and matches host endianness.
- Kind
- function
- Module
std.Io.Writer
pub fn writeUleb128(w: *Writer, value: anytype) Error!void
Write a single unsigned integer as LEB128 to the given writer.
- Kind
- function
- Module
std.Io.Writer
pub fn writeVec(w: *Writer, data: []const []const u8) Error!usize
If the total number of bytes of `data` fits inside `unusedCapacitySlice`, this function is guaranteed to not fail, not call into `VTable`, and return the total bytes inside `data`.
- Kind
- function
- Module
std.Io.Writer
pub fn writeVecAll(w: *Writer, data: [][]const u8) Error!void
The `data` parameter is mutable because this function needs to mutate the fields in order to handle partial writes from `VTable.writeSplat`.
- Kind
- function
- Module
std.Io.Writer