willow_data_model/
lib.rs

1#![doc(html_logo_url = "https://willowprotocol.org/named_assets/willow_emblem_standalone.png")]
2#![cfg_attr(not(feature = "std"), no_std)]
3
4//! # Willow Data Model
5//!
6//! This crate implements the [Willow Data Model](https://willowprotocol.org/specs/data-model/), with plenty of generics to account for all the [data model parameters](https://willowprotocol.org/specs/data-model/index.html#willow_parameters).
7//!
8//! As an application developer, you likely do not need to interact with this crate explicitly — use the [`willow25`](https://crates.io/crates/willow25) crate instead, which wraps this crate with ready-to-use non-generic types. As a library author, this crate *is* the right place. Code library functions against the [`Entrylike`](entry::Entrylike) trait, and use `P: AsRef<willow_data_model::paths::Path>` for paths. This will allow your library to work with crates such as [`willow25`](https://crates.io/crates/willow25), but to also work for all users who go with different parameterisations of Willow.
9
10pub mod paths;
11
12pub mod entry;
13
14mod timestamp;
15pub use timestamp::Timestamp;
16
17/// A “prelude” for crates using the `willow_data_model` crate.
18///
19/// This prelude is similar to the standard library’s prelude in that you’ll almost always want to import its entire contents, but unlike the standard library’s prelude you’ll have to do so manually:
20///
21/// `use willow_data_model::prelude::*;`
22///
23/// The prelude may grow over time.
24pub mod prelude {
25    pub use super::entry::{
26        Entry, EntryBuilder, EntryBuilderError, Entrylike, EntrylikeExt, Keylike,
27    };
28    pub use super::paths::*;
29    pub use super::timestamp::Timestamp;
30    pub use hifitime::prelude::*;
31}