[][src]Enum packs::ll::marker::Marker

pub enum Marker {
    TinyString(usize),
    TinyList(usize),
    TinyDictionary(usize),
    Structure(usize),
    PlusTinyInt(u8),
    MinusTinyInt(u8),
    Float64,
    Int8,
    Int16,
    Int32,
    Int64,
    Null,
    True,
    False,
    String8,
    String16,
    String32,
    Bytes8,
    Bytes16,
    Bytes32,
    List8,
    List16,
    List32,
    Dictionary8,
    Dictionary16,
    Dictionary32,
}

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 m = Marker::from_u8(0x81).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)
Structure(usize)
PlusTinyInt(u8)
MinusTinyInt(u8)
Float64
Int8
Int16
Int32
Int64
Null
True
False
String8
String16
String32
Bytes8
Bytes16
Bytes32
List8
List16
List32
Dictionary8
Dictionary16
Dictionary32

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 into_u8(self) -> u8[src]

pub fn from_u8(from: u8) -> Option<Marker>[src]

pub fn decode<T: Read>(reader: &mut T) -> Result<Marker, DecodeError>[src]

pub fn size_info(self) -> MarkerSizeInfo[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]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.