pub enum SpinelUint {}
Expand description

Marker type used to specify integers encoded with Spinel’s variable-length unsigned integer encoding.

This type is necessary because u32 is defined to mean a fixed-length encoding, whereas this type can be encoded with a variable length.

This type has no size and is used only with the TryPackAs/TryUnpackAs traits and in the base type for TryUnpack/TryOwnedUnpack.

Trait Implementations§

source§

impl Debug for SpinelUint

source§

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

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

impl TryOwnedUnpack for SpinelUint

§

type Unpacked = u32

The type of the unpacked result. This can be the same as Self, but in some cases it can be different. This is because Self is a marker type, and may not even be Sized. For example, if Self is SpinelUint, then Unpacked would be u32 (because SpinelUint is just a marker trait indicating a variably-sized unsigned integer).
source§

fn try_owned_unpack(iter: &mut Iter<'_, u8>) -> Result<Self::Unpacked>

Attempts to decode the data at the given iterator into an instance of Self, where Self must be an “owned” type.
source§

fn try_array_owned_unpack(iter: &mut Iter<'_, u8>) -> Result<Self::Unpacked>

Attempts to decode an item from an array at the given iterator into an instance of Self, where Self must be an “owned” type. Read more
source§

fn try_owned_unpack_from_slice(slice: &[u8]) -> Result<Self::Unpacked>

Convenience method for unpacking directly from a borrowed slice.
source§

impl TryPackAs<SpinelUint> for u32

source§

fn pack_as_len(&self) -> Result<usize>

Calculates how many bytes this type will use when serialized.
source§

fn try_pack_as<T: Write + ?Sized>(&self, buffer: &mut T) -> Result<usize>

Uses Spinel encoding to serialize to a given std::io::Write reference as the Spinel type identified by Marker.
source§

impl<'a> TryUnpack<'a> for SpinelUint

§

type Unpacked = <SpinelUint as TryOwnedUnpack>::Unpacked

The type of the unpacked result. This can be the same as Self, but in some cases it can be different. This is because Self is a marker type, and may not even be Sized. For example, if Self is SpinelUint, then Unpacked would be u32 (because SpinelUint is just a marker trait indicating a variably-sized unsigned integer).
source§

fn try_unpack(iter: &mut Iter<'a, u8>) -> Result<Self::Unpacked>

Attempts to decode the data at the given iterator into an instance of Self.
source§

fn try_array_unpack(iter: &mut Iter<'a, u8>) -> Result<Self::Unpacked>

Attempts to decode an item from an array at the given iterator into an instance of Self. Read more
source§

fn try_unpack_from_slice(slice: &'a [u8]) -> Result<Self::Unpacked>

Convenience method for unpacking directly from a borrowed slice.
source§

impl<'a> TryUnpackAs<'a, SpinelUint> for u32

source§

fn try_unpack_as(iter: &mut Iter<'a, u8>) -> Result<Self>

Attempts to decode the data (with a format determined by Marker) at the given iterator into an instance of Self.
source§

fn try_unpack_as_from_slice(slice: &'a [u8]) -> Result<Self>

Convenience method for unpacking directly from a borrowed slice.

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.