rmp::encode

Function write_sint

Source
pub fn write_sint<W: RmpWrite>(
    wr: &mut W,
    val: i64,
) -> Result<Marker, ValueWriteError<W::Error>>
Expand description

Encodes and attempts to write an i64 value into the given write using the most efficient representation, returning the marker used.

This function obeys the MessagePack specification, which requires that the serializer SHOULD use the format which represents the data in the smallest number of bytes, with the exception of sized/unsized types.

Note, that the function will always use signed integer representation even if the value can be more efficiently represented using unsigned integer encoding.

The first byte becomes the marker and the others (if present, up to 9) will represent the data itself.

ยงErrors

This function will return ValueWriteError on any I/O error occurred while writing either the marker or the data.