willow_data_model/lib.rs
1#![doc(html_logo_url = "https://willowprotocol.org/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 types and interfaces provided by this crate, so that your code can be used both by other generic code and by code specialised to any particular instantiation of the Willow protocols.
9//!
10//! Many trait methods in this crate have a name starting with `wdm` (**w**illow **d**ata **m**odel). This naming convention ensures that there are no naming conflicts with methods provided by types which specialise Willow to a particular set of parameters (such as the types of the [`willow25`](https://crates.io/crates/willow25) crate). This is slightly inconvenient when writing generic code, but ensures that application developers who only interact with specialised types get the smoothest possible development experience.
11
12pub mod paths;
13
14pub mod entry;
15
16mod timestamp;
17pub use timestamp::Timestamp;
18
19pub mod groupings;
20
21/// A “prelude” for crates using the `willow_data_model` crate.
22///
23/// 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:
24///
25/// `use willow_data_model::prelude::*;`
26///
27/// The prelude may grow over time.
28pub mod prelude {
29 pub use super::entry::{Entry, EntryBuilder, EntryBuilderError, Entrylike, EntrylikeExt};
30 pub use super::groupings::*;
31 pub use super::paths::*;
32 pub use super::timestamp::Timestamp;
33 pub use hifitime::prelude::*;
34}