Skip to documentation
SLOP

tiny.syn.SpanCapacity

Reference tiny.syn SpanCapacity

Defined in span.capacity.

The sizes that follow from one Limits value, computed without allocating.

API (5)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callsspan.capacityCapacity
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/syn/src/span/capacity.zig:39

zig
/// The sizes that follow from one `Limits` value, computed without allocating. A caller derives it/// before allocating, to learn the exact bytes span storage will take, and the storage keeps its/// own copy.pub const Capacity = struct {    /// The limits the sizes were derived from, as given.    limits: Limits,    /// The span capacity: how many spans the storage holds, equal to `limits.max_text_bytes`. A    /// line within the limit never needs more, because each kept span covers at least one byte and    /// no two overlap.    span_capacity: usize,    /// The bytes those spans take: `span_capacity` times the size of one `Span`.    span_bytes: usize,    /// The bytes `Storage.init` allocates, in one region, equal to `span_bytes`. `Storage.status`    /// reports the same number, and the README example checks that the two agree. The byte count is    /// zero when the limit is zero, and then `Storage.init` allocates nothing.    storage_bytes: usize,    /// Returns the sizes for `limits`. A caller computes the storage size ahead of time, for    /// example to check a memory budget, and `Storage.init` calls it too. `Capacity.derive` fails    /// with `error.CapacityOverflow` when `max_text_bytes` times the size of one `Span` overflows a    /// `usize`. The call allocates nothing and reads nothing but its argument.    pub fn derive(limits: Limits) DeriveError!Capacity {        const span_bytes = std.math.mul(            usize,            limits.max_text_bytes,            @sizeOf(model.Span),        ) catch return error.CapacityOverflow;        return .{            .limits = limits,            .span_capacity = limits.max_text_bytes,            .span_bytes = span_bytes,            .storage_bytes = span_bytes,        };    }};

Source: lib/syn/src/root.zig:47

zig
pub const SpanCapacity = span.Capacity;
Called byCallsNo direct callstest sourcelib.syn.src.span.capacitytest: syntax span capacity accepts it...test sourcelib.syn.src.span.capacitytest: syntax span capacity matches an...SpanCapacityderive
Static calls · unresolved targets: 0 · external targets: 0.

Also reachable as

span.Capacity.

Audit

Definitions2
Public names6
Members4
Version26.7.0
Revisiondaab053ee433