kitsune2_api/
lib.rs

1#![deny(missing_docs)]
2//! Kitsune2 API contains kitsune module traits and the basic types required
3//! to define the api of those traits.
4//!
5//! If you want to use Kitsune2 itself, please see the kitsune2 crate.
6
7/// Boxed future type.
8pub type BoxFut<'a, T> =
9    std::pin::Pin<Box<dyn std::future::Future<Output = T> + Send + 'a>>;
10
11pub(crate) mod serde_bytes_base64 {
12    pub fn serialize<S>(
13        b: &bytes::Bytes,
14        serializer: S,
15    ) -> Result<S::Ok, S::Error>
16    where
17        S: serde::Serializer,
18    {
19        use base64::prelude::*;
20        serializer.serialize_str(&BASE64_URL_SAFE_NO_PAD.encode(b))
21    }
22
23    pub fn deserialize<'de, D, T: From<bytes::Bytes>>(
24        deserializer: D,
25    ) -> Result<T, D::Error>
26    where
27        D: serde::Deserializer<'de>,
28    {
29        use base64::prelude::*;
30        let s: &'de str = serde::Deserialize::deserialize(deserializer)?;
31        BASE64_URL_SAFE_NO_PAD
32            .decode(s)
33            .map(|v| bytes::Bytes::copy_from_slice(&v).into())
34            .map_err(serde::de::Error::custom)
35    }
36}
37
38mod agent;
39pub use agent::*;
40
41mod arc;
42pub use arc::*;
43
44mod bootstrap;
45pub use bootstrap::*;
46
47mod builder;
48pub use builder::*;
49
50mod config;
51pub use config::*;
52
53mod kitsune;
54pub use kitsune::*;
55
56mod peer_store;
57pub use peer_store::*;
58
59mod space;
60pub use space::*;
61
62mod transport;
63pub use transport::*;
64
65mod error;
66pub use error::*;
67
68mod id;
69pub use id::*;
70
71mod timestamp;
72pub use timestamp::*;
73
74mod fetch;
75pub use fetch::*;
76
77mod peer_meta_store;
78pub use peer_meta_store::*;
79
80mod gossip;
81pub use gossip::*;
82
83mod local_agent_store;
84pub use local_agent_store::*;
85
86mod op_store;
87pub use op_store::*;
88
89mod protocol;
90pub use protocol::*;
91
92mod publish;
93pub use publish::*;
94
95mod url;
96pub use url::*;
97
98#[cfg(any(doc, docsrs))]
99pub mod doc;