[−][src]Enum packs::ll::types::lengths::Length
The possible lengths for sized types like String8
. The different sign extensions are according
to the PackStream specification. This type should be used for encoding any size information, e.g.
the 32bit size information of a String32
or Dictionary32
can be encoded using Length
:
use packs::ll::types::lengths::Length; let mut buffer = Vec::with_capacity(4); Length::Bit32(420420).encode(&mut buffer); assert_eq!(buffer, vec!(0x00, 0x06, 0x6A, 0x44), "Got: {:X?}", buffer);
It does not shrink the size to any lower space (e.g. using u8
instead of i32
).
Variants
Tiny(u8)
Bit8(u8)
Bit16(u16)
Bit32(i32)
Implementations
impl Length
[src]
pub fn marker(
self,
tiny_marker: fn(_: usize) -> Marker,
marker8: Marker,
marker16: Marker,
marker32: Marker
) -> Marker
[src]
self,
tiny_marker: fn(_: usize) -> Marker,
marker8: Marker,
marker16: Marker,
marker32: Marker
) -> Marker
pub fn from_usize(size: usize) -> Option<Length>
[src]
pub fn into_usize(self) -> usize
[src]
pub fn encode<T: Write>(self, writer: T) -> Result<usize, EncodeError>
[src]
Trait Implementations
impl Clone for Length
[src]
impl Copy for Length
[src]
impl Debug for Length
[src]
impl PartialEq<Length> for Length
[src]
impl StructuralPartialEq for Length
[src]
Auto Trait Implementations
impl RefUnwindSafe for Length
impl Send for Length
impl Sync for Length
impl Unpin for Length
impl UnwindSafe for Length
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,