Crate cuisiner

Source
Expand description

§cuisiner

Cook up some conversions to and from C-style binary layouts.

Cuisiner provides traits and macros to create idiomatic Rust structures that can be seamlessly converted to and from C-style binary representations, even if it has a different layout.

§Overview

Cuisiner centres on the derivable Cuisiner trait, which provides the ‘raw’ serialised type (via the Raw associated type), and methods used to serialise and deserialise from the raw value. The raw representation must align with the C representation of the structure, whilst the try_from_raw and try_to_raw methods can handle validation when converting to and from the idiomatic Rust representation.

§Example

See sqlite-header.rs for an example.

Re-exports§

pub use static_assertions;
pub use zerocopy;

Structs§

ByteBoolean
A boolean value represented with some number of bytes, where non-zero is true, and zero is false.
ConstI8
ConstI16
ConstI32
ConstI64
ConstI128
ConstIsize
ConstU8
ConstU16
ConstU32
ConstU64
ConstU128
ConstUsize
Reserved
Sequence of reserved bytes. Doesn’t validate when deserialising, and will serialise to 0.

Enums§

BigEndian
Big-endian byte order.
CuisinerError
LittleEndian
Little-endian byte order.

Traits§

ByteOrder
A type-level representation of byte order.
Cuisiner

Type Aliases§

NativeEndian
The endianness used by this platform.
NetworkEndian
The endianness used in many network protocols.

Derive Macros§

Cuisiner