Enum nachricht::Header[][src]

pub enum Header {
    Null,
    True,
    False,
    F32,
    F64,
    Bin(usize),
    Pos(u64),
    Neg(u64),
    Bag(usize),
    Str(usize),
    Sym(usize),
    Key(usize),
    Ref(usize),
}

Variants

Null

Also known as unit or nil

True

The boolean value true

False

The boolean value false

F32

The following four bytes contain an IEEE-754 32-bit floating point number

F64

The following eight bytes contain an IEEE-754 64-bit floating point number

Bin(usize)

The value describes the length of a following byte array. Note that this code also contains the five fixed length values.

Pos(u64)

The value describes a postive integer fitting into an u64

Neg(u64)

The value describes a negative integer whose negative fits into an u64

Bag(usize)

The value describes the length in fields of a container. the fields follow the header immediately.

Str(usize)

The value describes the length in bytes of a following unicode string

Sym(usize)

A symbol has the same semantics as a string except that it gets pushed into the symbol table and can be referenced from there

Key(usize)

The value describes the length in bytes of a following key value. This in itself does not define a field and thus has to immediately followed by another header whose field will be named by this key.

Ref(usize)

A reference into the symbol table. This could resolve to either a symbol (which itself resolve to a string) or a key.

Implementations

impl Header[src]

pub fn name(&self) -> &'static str[src]

Returns the mnemonic of the header. This is useful for error messages.

pub fn encode<W: Write>(&self, w: &mut W) -> Result<usize, EncodeError>[src]

Returns the number of written bytes

pub fn decode<B: ?Sized + AsRef<[u8]>>(
    buf: &B
) -> Result<(Self, usize), DecodeError>
[src]

Returns the decoded header and the number of consumed bytes

Trait Implementations

impl Clone for Header[src]

impl Copy for Header[src]

impl Debug for Header[src]

impl PartialEq<Header> for Header[src]

impl StructuralPartialEq for Header[src]

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

type Owned = T

The resulting type after obtaining ownership.

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.