Struct simple_tlv::Length[][src]

pub struct Length(_);

SIMPLE-TLV-encoded length.

By definition, in the range 0..=65535

The length field consists of one or three consecutive bytes.

  • If the first byte is not 0xFF, then the length field consists of a single byte encoding a number from zero to 254.
  • If the first byte is 0xFF, then the length field consists of the subsequent two bytes interpreted as big-endian integer, with any value from zero to 65,535.

Implementations

impl Length[src]

pub const fn zero() -> Self[src]

Return a length of 0.

pub const fn max() -> usize[src]

Get the maximum length supported by SIMPLE-TLV: 65,535.

pub fn to_usize(self) -> usize[src]

Convert length to usize.

Trait Implementations

impl Add<Length> for Length[src]

type Output = Result<Self>

The resulting type after applying the + operator.

impl Add<Length> for Result<Length>[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<u16> for Length[src]

type Output = Result<Self>

The resulting type after applying the + operator.

impl Add<u8> for Length[src]

type Output = Result<Self>

The resulting type after applying the + operator.

impl Add<usize> for Length[src]

type Output = Result<Self>

The resulting type after applying the + operator.

impl Clone for Length[src]

impl Copy for Length[src]

impl Debug for Length[src]

impl Decodable<'_> for Length[src]

impl Default for Length[src]

impl Display for Length[src]

impl Encodable for Length[src]

impl Eq for Length[src]

impl From<u16> for Length[src]

impl From<u8> for Length[src]

impl Ord for Length[src]

impl PartialEq<Length> for Length[src]

impl PartialOrd<Length> for Length[src]

impl StructuralEq for Length[src]

impl StructuralPartialEq for Length[src]

impl<'a> TryFrom<&'a [&'a (dyn Encodable + 'a)]> for Length[src]

Calculate the sum of the encoded lengths of the encodables.

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<usize> for Length[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.