Trait spinel_pack::TryUnpackAs

source ·
pub trait TryUnpackAs<'a, Marker: ?Sized>: Sized {
    // Required method
    fn try_unpack_as(iter: &mut Iter<'a, u8>) -> Result<Self>;

    // Provided method
    fn try_unpack_as_from_slice(slice: &'a [u8]) -> Result<Self> { ... }
}
Expand description

Trait for unpacking a spinel-encoded buffer to a specific type when the field type is known.

The generic parameter Marker is effectiely a part of the name of the trait and is not used directly by the trait. Types may implement more than one instance of this trait, each with a different marker type. For example, structs that use the spinel_packed attribute macro will implement both TryUnpackAs<[u8]> and TryUnpackAs<SpinelDataWlen> for handling the D and d Spinel field formats respectively when deserializing.

Required Methods§

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.

Provided Methods§

source

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

Convenience method for unpacking directly from a borrowed slice.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for &'a [u8]

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for bool

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for i8

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for i16

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for i32

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for i64

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for u8

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for u16

source§

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

source§

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

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for u64

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for ()

source§

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

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for Ipv6Addr

source§

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

source§

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

source§

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

source§

impl<'a> TryUnpackAs<'a, bool> for bool

source§

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

source§

impl<'a> TryUnpackAs<'a, i8> for i8

source§

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

source§

impl<'a> TryUnpackAs<'a, i16> for i16

source§

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

source§

impl<'a> TryUnpackAs<'a, i32> for i32

source§

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

source§

impl<'a> TryUnpackAs<'a, i64> for i64

source§

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

source§

impl<'a> TryUnpackAs<'a, str> for &'a str

source§

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

source§

impl<'a> TryUnpackAs<'a, str> for &'a [u8]

source§

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

source§

impl<'a> TryUnpackAs<'a, str> for String

source§

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

source§

impl<'a> TryUnpackAs<'a, str> for Vec<u8>

source§

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

source§

impl<'a> TryUnpackAs<'a, u8> for u8

source§

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

source§

impl<'a> TryUnpackAs<'a, u16> for u16

source§

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

source§

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

source§

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

source§

impl<'a> TryUnpackAs<'a, u64> for u64

source§

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

source§

impl<'a> TryUnpackAs<'a, ()> for ()

source§

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

source§

impl<'a> TryUnpackAs<'a, Ipv6Addr> for Ipv6Addr

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for &'a [u8]

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for bool

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for i8

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for i16

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for i32

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for i64

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for u8

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for u16

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for u32

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for u64

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for ()

source§

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

source§

impl<'a> TryUnpackAs<'a, [u8]> for Ipv6Addr

source§

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

source§

impl<'a, T> TryUnpackAs<'a, SpinelDataWlen> for Vec<T>
where Self: TryUnpackAs<'a, [u8]>,

source§

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

source§

impl<'a, T> TryUnpackAs<'a, [u8]> for Vec<T>
where Self: TryUnpack<'a, Unpacked = Self>,

source§

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

source§

impl<'a, T, const N: usize> TryUnpackAs<'a, SpinelDataWlen> for [T; N]
where Self: TryUnpackAs<'a, [u8]>,

source§

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

source§

impl<'a, T, const N: usize> TryUnpackAs<'a, [u8]> for [T; N]
where Self: TryUnpack<'a, Unpacked = Self>,

source§

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

Implementors§

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for EUI48

source§

impl<'a> TryUnpackAs<'a, SpinelDataWlen> for EUI64

source§

impl<'a> TryUnpackAs<'a, EUI48> for EUI48

source§

impl<'a> TryUnpackAs<'a, EUI64> for EUI64

source§

impl<'a> TryUnpackAs<'a, [u8]> for EUI48

source§

impl<'a> TryUnpackAs<'a, [u8]> for EUI64