[−][src]Enum packs::ll::marker::Marker
Overview
A Marker
is the first byte of any encoded value in PackStream. It denotes what type the encoded
value is and might carry some size information.
Size as part of the marker
Some marker have as their second nibble size information, which ranges from 0x00
to 0x0F
.
This information is part of Marker
. The higher nibble information the just flags the type. It
can be checked against using MarkerHighNibble
, which only
carries the type information.
use packs::ll::marker::{Marker, MarkerHighNibble}; let mut buf : &[u8] = &[0x81]; let m = Marker::decode(&mut buf).unwrap(); // TinyString of length 1. assert_eq!(MarkerHighNibble::TinyString, m.high_nibble());
Special types
There are two special marker, PlusTinyInt
and MinusTinyInt
which carry not only the type
information, but the value itself. The extra information is just the read byte, hence any
interpretation has to be done on the provided value, see e.g.
byte_to_minus_tiny_int()
.
Variants
TinyString(usize)
TinyList(usize)
TinyDictionary(usize)
PlusTinyInt(u8)
MinusTinyInt(u8)
Implementations
impl Marker
[src]
pub fn high_nibble(&self) -> MarkerHighNibble
[src]
pub fn encode<T: Write>(self, into: &mut T) -> Result<usize>
[src]
pub fn decode<T: Read>(reader: &mut T) -> Result<Marker, DecodeError>
[src]
Trait Implementations
impl Clone for Marker
[src]
impl Copy for Marker
[src]
impl Debug for Marker
[src]
impl Display for Marker
[src]
impl PartialEq<Marker> for Marker
[src]
impl StructuralPartialEq for Marker
[src]
Auto Trait Implementations
impl RefUnwindSafe for Marker
impl Send for Marker
impl Sync for Marker
impl Unpin for Marker
impl UnwindSafe for Marker
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> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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>,