tiny.content.Extent
Defined in tiny.content.
An extent gives the exact byte length of one piece of content to size the buffer a read will fill.
API (3)
Actions
Public operations.
fromUsize: Converts a byte length a caller measured on the host into the extent a reference carries, and returnsContentExtentExceededwhen the length is wider than theu32an extent holds.toUsize: Widens an extent to the host'susize, for a caller slicing a buffer to the content's length.
Fields and members
Public fields and members.
Source
Source: lib/content/src/model.zig:64
zig
/// An extent gives the exact byte length of one piece of content to size the/// buffer a read will fill. The struct holds that length as a `u32`, which puts/// the largest representable content at `maximum_extent_bytes`.pub const Extent = struct { bytes: u32, /// Converts a byte length a caller measured on the host into the extent a /// reference carries, and returns `ContentExtentExceeded` when the length /// is wider than the `u32` an extent holds. pub fn fromUsize(bytes: usize) ReferenceError!Extent { return .{ .bytes = std.math.cast(u32, bytes) orelse return error.ContentExtentExceeded, }; } /// Widens an extent to the host's `usize`, for a caller slicing a buffer to /// the content's length. pub fn toUsize(self: Extent) usize { return @intCast(self.bytes); }};Source: lib/content/src/root.zig:29
zig
pub const Extent = model.Extent;Audit
| Definitions | 3 |
|---|---|
| Public names | 3 |
| Members | 1 |
| Version | 26.7.0 |
| Revision | daab053ee433 |