[−][src]Struct simple_tlv::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.
fn add(self, other: Self) -> Result<Self>
[src]
impl Add<Length> for Result<Length>
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Length) -> Self
[src]
impl Add<u16> for Length
[src]
type Output = Result<Self>
The resulting type after applying the +
operator.
fn add(self, other: u16) -> Result<Self>
[src]
impl Add<u8> for Length
[src]
type Output = Result<Self>
The resulting type after applying the +
operator.
fn add(self, other: u8) -> Result<Self>
[src]
impl Add<usize> for Length
[src]
type Output = Result<Self>
The resulting type after applying the +
operator.
fn add(self, other: usize) -> Result<Self>
[src]
impl Clone for Length
[src]
fn clone(&self) -> Length
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Length
[src]
impl Debug for Length
[src]
impl Decodable<'_> for Length
[src]
fn decode(decoder: &mut Decoder<'_>) -> Result<Length>
[src]
fn from_bytes(bytes: &'a [u8]) -> Result<Self>
[src]
impl Default for Length
[src]
impl Display for Length
[src]
impl Encodable for Length
[src]
fn encoded_length(&self) -> Result<Length>
[src]
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<()>
[src]
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8]>
[src]
impl Eq for Length
[src]
impl From<Length> for u16
[src]
impl From<Length> for usize
[src]
impl From<u16> for Length
[src]
impl From<u8> for Length
[src]
impl Ord for Length
[src]
fn cmp(&self, other: &Length) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Length> for Length
[src]
impl PartialOrd<Length> for Length
[src]
fn partial_cmp(&self, other: &Length) -> Option<Ordering>
[src]
fn lt(&self, other: &Length) -> bool
[src]
fn le(&self, other: &Length) -> bool
[src]
fn gt(&self, other: &Length) -> bool
[src]
fn ge(&self, other: &Length) -> bool
[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.
fn try_from(encodables: &[&dyn Encodable]) -> Result<Length>
[src]
impl TryFrom<usize> for Length
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,