1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg_attr(not(feature = "std"), macro_use)]
#[cfg(not(feature = "std"))]
extern crate alloc;
pub use armour_derive::*;
pub use collections::cid::{bytes_unsafe, Cid};
pub use collections::entry::Entry;
pub use collections::id::{Id, RecordStatus};
pub use collections::record::Record;
pub use datetime::Datetime;
pub use duration::Duration;
pub use dyn_types::{
get_type::GetType,
key_type::{GetKeyType, KeyBytes, KeyType},
value::Value,
Typ,
};
pub mod collections;
pub mod datetime;
pub mod duration;
pub mod dyn_types;
#[macro_export]
macro_rules! bf_hasher {
($m_name: ident, $name: ident, $key: expr) => {
pub mod $m_name {
use armour::{
collections::ident::{IdHasher, ID},
Id,
};
use blowfish::BlowfishLE;
use once_cell::sync::Lazy;
static BF: once_cell::sync::Lazy<BlowfishLE> =
Lazy::new(|| armour::collections::ident::create_bf($key));
#[derive(Debug, PartialOrd, Ord, PartialEq, Eq, Clone, Copy, Default)]
pub struct Hasher;
impl IdHasher for Hasher {
#[inline]
fn get_hasher() -> &'static BlowfishLE {
Lazy::force(&BF)
}
fn get_name() -> &'static str {
stringify!($name)
}
}
pub type $name = ID<Hasher>;
pub type Ident = Id<Hasher>;
}
};
}