Skip to main content

Matter

Struct Matter 

Source
pub struct Matter<'a, C: CesrCode> { /* private fields */ }
Available on crate feature 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>

Source

pub const PAD: &'static str = "_"

B64 pad char for special codes with xtra size pre-padded soft values

Source

pub const fn code(&self) -> &C

Returns the CESR code of this primitive.

Source

pub fn soft(&self) -> &str

Returns the soft (variable-length metadata) field of this primitive.

Source

pub fn raw(&self) -> &[u8]

Returns the raw binary payload of this primitive.

Source§

impl<C: CesrCode> Matter<'_, C>

Source

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.

Source

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>

Source

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>

Source

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.

Trait Implementations§

Source§

impl<'a, C: Clone + CesrCode> Clone for Matter<'a, C>

Source§

fn clone(&self) -> Matter<'a, C>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, C: Debug + CesrCode> Debug for Matter<'a, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, C: Eq + CesrCode> Eq for Matter<'a, C>

Source§

impl<'a, C: PartialEq + CesrCode> PartialEq for Matter<'a, C>

Source§

fn eq(&self, other: &Matter<'a, C>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a, C: PartialEq + CesrCode> StructuralPartialEq for Matter<'a, C>

Auto Trait Implementations§

§

impl<'a, C> Freeze for Matter<'a, C>
where C: Freeze,

§

impl<'a, C> RefUnwindSafe for Matter<'a, C>
where C: RefUnwindSafe,

§

impl<'a, C> Send for Matter<'a, C>
where C: Send,

§

impl<'a, C> Sync for Matter<'a, C>
where C: Sync,

§

impl<'a, C> Unpin for Matter<'a, C>
where C: Unpin,

§

impl<'a, C> UnsafeUnpin for Matter<'a, C>
where C: UnsafeUnpin,

§

impl<'a, C> UnwindSafe for Matter<'a, C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.