tiny.peer.Capacity
Defined in tiny.peer.
API (6)
Actions
Public operations.
Types and contracts
Public types and contracts.
Fields and members
Public fields and members.
Source
Source: lib/peer/src/ticket.zig:34
zig
pub const Capacity = struct { max_addresses: u8, wire_bytes: u17, text_bytes: u17, storage_bytes: usize, pub const DeriveError: type = CapacityDeriveError; pub fn derive(limits: Limits) DeriveError!Capacity { const bodies = std.math.mul( usize, limits.max_addresses, address_wire_bytes_max, ) catch return error.CapacityOverflow; const wire_bytes = std.math.add(usize, wire_header_bytes, bodies) catch return error.CapacityOverflow; const text_body = text.encodedLength(wire_bytes); const text_bytes = std.math.add(usize, text_prefix.len, text_body) catch return error.CapacityOverflow; const storage_bytes = std.math.mul( usize, limits.max_addresses, @sizeOf(Address), ) catch return error.CapacityOverflow; return .{ .max_addresses = limits.max_addresses, .wire_bytes = std.math.cast(u17, wire_bytes) orelse return error.CapacityOverflow, .text_bytes = std.math.cast(u17, text_bytes) orelse return error.CapacityOverflow, .storage_bytes = storage_bytes, }; }};Source: lib/peer/src/root.zig:30
zig
pub const Capacity = ticket.Capacity;Audit
| Definitions | 3 |
|---|---|
| Public names | 3 |
| Members | 4 |
| Version | 26.7.0 |
| Revision | daab053ee433 |