ic_stable_memory/encoding/mod.rs
1//! Traits and encoding algorithms used by this crate.
2//!
3//! Encoding relies on a notion of fixed and dynamically sized data. Fixed size encoding is performed
4//! via custom algorithm heavily based on const generics. Dynamically sized data encoding can be overriden
5//! by users of this crate, with a custom default implementation.
6//!
7//! By default this crate provides an implementation of [AsDynSizeBytes] trait for many types. But if
8//! one wants to use their own serialization engine for unsized data (for example, [Speedy](https://docs.rs/speedy/latest/speedy/)),
9//! they can do the following:
10//!
11//! ```toml
12//! // Cargo.toml
13//!
14//! [dependencies]
15//! ic-stable-memory = { version: "0.4", features = ["custom_dyn_encoding"] }
16//! ```
17//!
18//! This will disable all default implementations of [AsDynSizeBytes] trait allowing you to implement
19//! this trait by yourself in whatever way you prefer.
20
21pub mod dyn_size;
22pub mod fixed_size;
23
24pub use dyn_size::AsDynSizeBytes;
25pub use fixed_size::{AsFixedSizeBytes, Buffer};