Module decode

Source
Expand description

Provides various functions and structs for MessagePack decoding.

Most of the function defined in this module will silently handle interruption error (EINTR) received from the given Read to be in consistent state with the Write::write_all method in the standard library.

Any other error would immediately interrupt the parsing process. If your reader can results in I/O error and simultaneously be a recoverable state (for example, when reading from non-blocking socket and it returns EWOULDBLOCK) be sure that you buffer the data externally to avoid data loss (using BufRead readers with manual consuming or some other way).

Re-exports§

pub use bytes::Bytes;

Modules§

bytes
Implementation of the Bytes type

Structs§

ExtMeta
Extension type meta information.
MarkerReadError
An error that can occur when attempting to read a MessagePack marker from the reader.

Enums§

DecodeStringError
NumValueReadError
An error which can occur when attempting to read a MessagePack numeric value from the reader.
ValueReadError
An error which can occur when attempting to read a MessagePack value from the reader.

Traits§

RmpRead
A type that rmp supports reading from.
RmpReadErr
The error type for I/O operations on RmpRead and associated traits.

Functions§

marker_to_len
read_array_len
Attempts to read up to 5 bytes from the given reader and to decode them as a big-endian u32 array size.
read_bin_len
Attempts to read up to 5 bytes from the given reader and to decode them as Binary array length.
read_bool
Attempts to read a single byte from the given reader and to decode it as a boolean value.
read_ext_meta
read_f32
Attempts to read exactly 5 bytes from the given reader and to decode them as f32 value.
read_f64
Attempts to read exactly 9 bytes from the given reader and to decode them as f64 value.
read_fixext1
Attempts to read exactly 3 bytes from the given reader and interpret them as a fixext1 type with data attached.
read_fixext2
Attempts to read exactly 4 bytes from the given reader and interpret them as a fixext2 type with data attached.
read_fixext4
Attempts to read exactly 6 bytes from the given reader and interpret them as a fixext4 type with data attached.
read_fixext8
Attempts to read exactly 10 bytes from the given reader and interpret them as a fixext8 type with data attached.
read_fixext16
Attempts to read exactly 18 bytes from the given reader and interpret them as a fixext16 type with data attached.
read_i8
Attempts to read exactly 2 bytes from the given reader and to decode them as i8 value.
read_i16
Attempts to read exactly 3 bytes from the given reader and to decode them as i16 value.
read_i32
Attempts to read exactly 5 bytes from the given reader and to decode them as i32 value.
read_i64
Attempts to read exactly 9 bytes from the given reader and to decode them as i64 value.
read_int
Attempts to read up to 9 bytes from the given reader and to decode them as integral T value.
read_map_len
Attempts to read up to 5 bytes from the given reader and to decode them as a big-endian u32 map size.
read_marker
Attempts to read a single byte from the given reader and to decode it as a MessagePack marker.
read_nfix
Attempts to read a single byte from the given reader and to decode it as a negative fixnum value.
read_nil
Attempts to read a single byte from the given reader and to decode it as a nil value.
read_pfix
Attempts to read a single byte from the given reader and to decode it as a positive fixnum value.
read_str
Attempts to read a string data from the given reader and copy it to the buffer provided.
read_str_from_slice
Attempts to read and decode a string value from the reader, returning a borrowed slice from it.
read_str_len
Attempts to read up to 9 bytes from the given reader and to decode them as a string u32 size value.
read_str_refDeprecated
Attempts to read and decode a string value from the reader, returning a borrowed slice from it.
read_u8
Attempts to read exactly 2 bytes from the given reader and to decode them as u8 value.
read_u16
Attempts to read exactly 3 bytes from the given reader and to decode them as u16 value.
read_u32
Attempts to read exactly 5 bytes from the given reader and to decode them as u32 value.
read_u64
Attempts to read exactly 9 bytes from the given reader and to decode them as u64 value.

Type Aliases§

ErrorDeprecated
An alias to the “default” error handling type.