pub struct Matter<'a, C: CesrCode> { /* private fields */ }core only.Expand description
A CESR-encoded primitive with typed code C, a raw payload, and an optional soft field.
Implementations§
Source§impl<'a, C: CesrCode> Matter<'a, C>
impl<'a, C: CesrCode> Matter<'a, C>
Source§impl<C: CesrCode> Matter<'_, C>
impl<C: CesrCode> Matter<'_, C>
Sourcepub fn to_qb64b(&self) -> Vec<u8> ⓘ
pub fn to_qb64b(&self) -> Vec<u8> ⓘ
Encodes this primitive into its qualified Base64 (qb64) CESR wire
format as bytes (qb64b).
The output is allocated once at the final size fs; the Base64 payload
is written directly into it, then the header (code + soft field) is
written over the first cs bytes. Supports all fixed- and variable-size
CESR codes.
§Panics
Panics only on an internal-invariant break (a corrupt sizage table or a
mis-sized output buffer) — impossible for any Matter built through the
validated builder. This mirrors [Indexer::to_qb64] and is the
programmer-bug carve-out, not a data-validation path.
Sourcepub fn to_qb64(&self) -> String
pub fn to_qb64(&self) -> String
Encodes this primitive into its qualified Base64 (qb64) CESR wire format
as a String.
qb64 output is pure ASCII (URL-safe Base64 alphabet + CESR code chars), so UTF-8 validity is guaranteed by construction.
§Panics
Never, in practice: see Self::to_qb64b. The from_utf8 step cannot
fail because qb64 bytes are ASCII.
Source§impl<C: CesrCode> Matter<'_, C>
impl<C: CesrCode> Matter<'_, C>
Sourcepub fn into_static(self) -> Matter<'static, C>
pub fn into_static(self) -> Matter<'static, C>
Convert to Matter<'static> by owning any borrowed fields.
Near-zero cost: raw is always already owned (base64 decode produces
new bytes), so only the soft field (0-4 bytes for most codes) is
cloned when borrowed.
Source§impl<'a> Matter<'a, MatterCode>
impl<'a> Matter<'a, MatterCode>
Sourcepub fn narrow<C>(self) -> Result<Matter<'a, C>, ValidationError>
pub fn narrow<C>(self) -> Result<Matter<'a, C>, ValidationError>
Converts this untyped Matter<MatterCode> into a typed Matter<C>.
§Errors
Returns a ValidationError if the code cannot be narrowed to C.