1#[doc(inline)]
7pub use self::{hash::*, keys::*, primitives::*, specs::*};
8
9pub(crate) mod hash;
10pub(crate) mod keys;
11pub(crate) mod primitives;
12pub(crate) mod utils;
13
14pub(crate) mod specs {
15 use crate::hash::{hasher, H256};
16
17 pub trait Hashable
18 where
19 Self: std::fmt::Display,
20 {
21 fn hash(&self) -> H256;
22 }
23
24 pub trait HashableExt: Hashable {
25 fn hasher(&self, deg: Option<usize>) -> H256 {
26 let s: H256 = hasher(&self).into();
27
28 let mut res: H256 = s;
29 for _ in 0..deg.unwrap_or(1) {
30 res = hasher(&res.clone()).into()
31 }
32 res
33 }
34 }
35
36 pub trait ArrayLike<T, E: std::error::Error> {
37 fn flush(&mut self) -> Result<(), E>;
38 fn get(&self, index: usize) -> Result<Option<T>, E>;
39 fn is_empty(&self) -> Result<bool, E>;
40 fn len(&self) -> Result<usize, E>;
41 fn position(&self, item: &T) -> Result<Option<usize>, E>;
42 fn push(&mut self, item: T) -> Result<usize, E>;
43 }
44
45 }