holochain_types/
lib.rs

1//! Common types used by other Holochain crates.
2//!
3//! This crate is a complement to the
4//! [holochain_zome_types crate](https://crates.io/crates/holochain_zome_types),
5//! which contains only the essential types which are used in Holochain DNA
6//! code. This crate expands on those types to include all types which Holochain
7//! itself depends on.
8
9#![deny(missing_docs)]
10// We have a lot of usages of type aliases to `&String`, which clippy objects to.
11#![allow(clippy::ptr_arg)]
12// TODO - address the underlying issue:
13#![allow(clippy::result_large_err)]
14#![allow(non_local_definitions)]
15
16pub mod access;
17pub mod action;
18pub mod activity;
19pub mod app;
20pub mod autonomic;
21pub mod chain;
22pub mod combinators;
23pub mod countersigning;
24pub mod db;
25pub mod dht_op;
26pub mod dna;
27pub mod entry;
28pub mod link;
29mod macros;
30pub mod metadata;
31pub mod prelude;
32pub mod rate_limit;
33pub mod record;
34pub mod share;
35pub mod signal;
36#[warn(missing_docs)]
37pub mod sql;
38pub mod validation_receipt;
39pub mod warrant;
40pub mod web_app;
41pub mod zome_types;
42
43#[cfg(feature = "fixturators")]
44pub mod fixt;
45
46#[cfg(feature = "test_utils")]
47pub mod inline_zome;
48pub mod network;
49#[cfg(feature = "test_utils")]
50pub mod test_utils;
51pub mod websocket;
52
53pub use holochain_zome_types::entry::EntryHashed;
54
55/// Convert to the older deepkey version of an HDK prelude type
56#[macro_export]
57macro_rules! deepkey_roundtrip_backward(
58    ($t:ident, $v:expr) => {{
59        let v: &$t = $v;
60        let v: hc_deepkey_sdk::hdk::prelude::$t = holochain_serialized_bytes::decode(
61            &holochain_serialized_bytes::encode(v).expect("Couldn't roundtrip encode"),
62        )
63        .expect("Couldn't roundtrip decode");
64        v
65    }}
66);
67
68/// Convert from the older deepkey version of an HDK prelude type
69#[macro_export]
70macro_rules! deepkey_roundtrip_forward(
71    ($t:ident, $v:expr) => {{
72        let v: &hc_deepkey_sdk::hdk::prelude::$t = $v;
73        let v: $t = holochain_serialized_bytes::decode(
74            &holochain_serialized_bytes::encode($v).expect("Couldn't roundtrip encode"),
75        )
76        .expect("Couldn't roundtrip decode");
77        v
78    }}
79);