rmp::decode

Function read_pfix

Source
pub fn read_pfix<R: RmpRead>(rd: &mut R) -> Result<u8, ValueReadError<R::Error>>
Expand description

Attempts to read a single byte from the given reader and to decode it as a positive fixnum value.

According to the MessagePack specification, a positive fixed integer value is represented using a single byte in [0x00; 0x7f] range inclusively, prepended with a special marker mask.

§Errors

This function will return ValueReadError on any I/O error while reading the marker, except the EINTR, which is handled internally.

It also returns ValueReadError::TypeMismatch if the actual type is not equal with the expected one, indicating you with the actual type.

§Note

This function will silently retry on every EINTR received from the underlying Read until successful read.