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§
- Byte
Boolean - A boolean value represented with some number of bytes, where non-zero is true, and zero is false.
- ConstI8
- Const
I16 - Const
I32 - Const
I64 - Const
I128 - Const
Isize - ConstU8
- Const
U16 - Const
U32 - Const
U64 - Const
U128 - Const
Usize - Reserved
- Sequence of reserved bytes. Doesn’t validate when deserialising, and will serialise to
0.
Enums§
- BigEndian
- Big-endian byte order.
- Cuisiner
Error - Little
Endian - Little-endian byte order.
Traits§
Type Aliases§
- Native
Endian - The endianness used by this platform.
- Network
Endian - The endianness used in many network protocols.