Crate bincode_core[][src]

Embedded bincode

This crate allows [bincode] to be used on embedded devices that run in #![no_std].

Currently this is not possible because bincode requires that the given types implement std::io::Write or std::io::Read, and bincode supports (de)serializing alloc types like Vec and String.

This crate is an alternative (but mostly similar) for bincode that works on microcontrollers. It does this by not supporting types like Vec and String.

Types like &str and &[u8] are supported. This is possible because CoreRead has a requirement that the data being read, has to be persisted somewhere. Usually this is done by a fixed-size backing array. The &str and &[u8] then simply point to a position in that buffer.

Re-exports

pub use self::config::DefaultOptions;

Modules

config

Contains helper structs to customize the way your structs are (de)serialized.

Structs

BufferWriter

An implementation of CoreWrite. This buffer writer will write data to a backing &mut [u8].

Enums

BufferWriterError

Errors that can be returned from writing to a BufferWriter.

DeserializeError

Errors that can occur while deserializing

SerializeError

Any error that can be thrown while serializing a type

Traits

CoreRead

A target that can be read from. This is similar to std::io::Read, but the std trait is not available in #![no_std] projects.

CoreWrite

A target that can be written to. This is similar to std::io::Write, but the std trait is not available in #![no_std] projects.

Functions

deserialize

Deserialize a given object from the given CoreRead object.

serialize

Serialize a given T type into a given CoreWrite writer with the given B byte order.

serialize_size

Return the size that serializing a given T type would need to be stored. This is an optimized version of getting the length of the writer after it’s done writing.