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#![allow(async_fn_in_trait)]
4
5//! # Willow Data Model
6//!
7//! 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).
8//!
9//! 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.
10//!
11//! 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.
12
13pub mod paths;
14
15pub mod entry;
16
17mod timestamp;
18pub use timestamp::Timestamp;
19
20pub mod groupings;
21
22pub mod authorisation;
23
24#[cfg(feature = "dev")]
25pub mod test_parameters;
26
27/// A “prelude” for crates using the `willow_data_model` crate.
28///
29/// 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:
30///
31/// `use willow_data_model::prelude::*;`
32///
33/// The prelude may grow over time.
34pub mod prelude {
35 pub use super::authorisation::*;
36 pub use super::entry::{Entry, EntryBuilder, EntryBuilderError, Entrylike, EntrylikeExt};
37 pub use super::groupings::*;
38 pub use super::paths::{
39 Component, InvalidComponentError, OwnedComponent, Path, PathBuilder, PathError,
40 PathFromComponentsError,
41 };
42 pub use super::timestamp::Timestamp;
43 pub use hifitime::prelude::*;
44
45 #[cfg(feature = "dev")]
46 pub use super::test_parameters::*;
47}