[−][src]Crate store
store
is a dead simple binary (de)serializer utilizing the
Serialize
and Deserialize
traits
provided by serde
.
It is fully compatible with std
, no_std
, and no_std
+ alloc
.
Installation
To use store
, add this to your Cargo.toml:
[dependencies]
store = "0.1-alpha.1"
Dumping types
store
can dump types that implement Serialize
into
mutable byte buffers.
use serde_derive::Serialize; use store::Dump; #[derive(Serialize)] struct Foo(u32); fn main() -> store::Result<()> { let mut buf = [0; 4]; let foo = Foo(42); foo.dump_into_bytes(&mut buf[..])?; Ok(()) }
Loading types
store
will also decode structures that implement
Deserialize
from byte buffers.
use serde_derive::Deserialize; use store::Load; #[derive(Deserialize)] struct Bar(u32); fn main() -> store::Result<()> { let buf = [0; 4]; let bar = Bar::load_from_bytes(&buf[..])?; Ok(()) }
Structs
ULeb128 | Unsigned LEB128 variable-length encoding. |
Enums
Error | Errors that can occur when dumping/loading data. |
Traits
Dump | Dump an object into a byte stream. |
Load | Load an object from a byte stream. |
Type Definitions
Result | A specialized |