Module postcard::fixint

source ·
Expand description

§Fixed Size Integers

In some cases, the use of variably length encoded data may not be preferrable. These modules, for use with #[serde(with = ...)] “opt out” of variable length encoding.

Support explicitly not provided for usize or isize, as these types would not be portable between systems of different pointer widths.

Although all data in Postcard is typically encoded in little-endian order, these modules provide a choice to the user to encode the data in either little or big endian form, which may be useful for zero-copy applications.

Modules§

  • Use with the #[serde(with = "postcard::fixint::be")] field attribute. Disables varint serialization/deserialization for the specified integer field. The integer will always be serialized in the same way as a fixed size array, in Big Endian order on the wire.
  • Use with the #[serde(with = "postcard::fixint::le")] field attribute. Disables varint serialization/deserialization for the specified integer field. The integer will always be serialized in the same way as a fixed size array, in Little Endian order on the wire.