Skip to documentation
SLOP

tiny.acp.ReaderCapacity

Reference tiny.acp ReaderCapacity

Defined in tiny.acp.

A caller learns the buffer size before any buffer exists, for example to set aside the reader's share of one larger region of memory.

API (3)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callstiny.acpReaderCapacity
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/acp/src/reader/capacity.zig:19

zig
/// A caller learns the buffer size before any buffer exists, for example to set aside the reader's/// share of one larger region of memory. The structure holds the line limit and the buffer size it/// needs. `derive` builds it. Another program in the repository adds the buffer size into the size/// of one region it allocates up front. The package exports it as `acp.ReaderCapacity`.pub const Capacity = struct {    /// The line limit, copied from `Limits`.    message_bytes: usize,    /// The buffer size: the line limit plus one byte, for the newline after a longest line. The    /// value is always above the line limit and above zero.    storage_bytes: usize,    /// A caller works out the buffer size for a line limit and learns early when the limit is too    /// large. The function returns the line limit with its buffer size. The call fails with    /// `error.CapacityOverflow` when the limit plus one does not fit in a `usize`. The call    /// allocates nothing.    pub fn derive(limits: Limits) DeriveError!Capacity {        const storage_bytes = std.math.add(usize, limits.message_bytes, 1) catch            return error.CapacityOverflow;        std.debug.assert(storage_bytes > limits.message_bytes);        std.debug.assert(storage_bytes != 0);        return .{            .message_bytes = limits.message_bytes,            .storage_bytes = storage_bytes,        };    }};

Source: lib/acp/src/root.zig:86

zig
pub const ReaderCapacity = reader.Capacity;
Called byCallsNo direct callstest sourcelib.acp.src.reader.capacitytest: ACP reader capacity matches ind...ReaderCapacityderive
Static calls · unresolved targets: 0 · external targets: 0.

Also reachable as

reader.Capacity.

Audit

Definitions2
Public names4
Members2
Version26.7.0
Revisiondaab053ee433