Skip to main content

Header

Struct Header 

Source
pub struct Header<'a> { /* private fields */ }
Expand description

Borrowed received header. Successful header decoding makes no payload claim.

Numeric argument copies are wiped on drop. The received bytes remain owned by the caller, which must provide a zeroizing owner for sensitive input.

Implementations§

Source§

impl<'a> Header<'a>

Source

pub const fn received_bytes(&self) -> &'a [u8] ⓘ

Exact received header bytes, including any non-preferred width.

Source

pub const fn major_type(&self) -> CodecGeneralCborMajorType

Inspect the major type.

Source

pub const fn argument_width(&self) -> CodecGeneralCborArgumentWidth

Inspect the received argument or float-payload width.

Source

pub fn argument(&self) -> Option<u64>

Return an integer argument; floats, indefinite lengths, and breaks have none.

Source

pub fn has_preferred_argument(&self) -> Option<bool>

Observe shortest argument encoding independently of payload validation. Floats, indefinite lengths, and breaks return None.

Source

pub fn has_preferred_float(&self) -> Result<Option<bool>, CborError>

Observe whether a float uses the shortest width that holds its value exactly, including NaN significands. Non-float headers return None.

Source

pub const fn is_float(&self) -> bool

Inspect whether this header carries IEEE floating-point bits.

Source

pub fn float(&self) -> Result<Option<Float>, CborError>

Extract owned protected floating-point bits, if present.

Source

pub fn simple_value(&self) -> Result<Option<u8>, CborError>

Extract a simple-value code; floats and breaks return None.

Trait Implementations§

Source§

impl Drop for Header<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl ZeroizeOnDrop for Header<'_>

Auto Trait Implementations§

§

impl<'a> Forget for Header<'a>

§

impl<'a> Freeze for Header<'a>

§

impl<'a> Move for Header<'a>

§

impl<'a> RefUnwindSafe for Header<'a>

§

impl<'a> Send for Header<'a>

§

impl<'a> Sync for Header<'a>

§

impl<'a> Unpin for Header<'a>

§

impl<'a> UnsafeUnpin for Header<'a>

§

impl<'a> UnwindSafe for Header<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.