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
/*
   Appellation: acme-core
   Context: library
   Creator:
   Description:
       Core feature library for acme, an all-in-one blockchain toolkit for building optimized
       EVM compatible apps and chains.
*/
pub use crate::{actors::*, apps::*, common::*, connections::*, controllers::*, errors::*};

mod actors;
mod apps;
mod connections;
mod controllers;
mod errors;

mod common {
    pub use types::*;

    mod types {
        pub use bson::oid::ObjectId;
        pub use bson::DateTime;
        pub use chrono::{Local, Utc};

        pub type Container<T = String> = Dictionary<Vec<T>>;
        pub type Dictionary<T = String> = std::collections::HashMap<String, T>;

        #[derive(Clone, Debug, Hash, PartialEq, serde::Deserialize, serde::Serialize)]
        pub struct Timestamp {
            timestamp: i64,
        }

        impl Timestamp {
            pub fn new(timestamp: i64) -> Self {
                Self { timestamp }
            }
            pub fn utc() -> Self {
                Self::new(Utc::now().timestamp())
            }
            pub fn local() -> Self {
                Self::new(Local::now().timestamp())
            }
        }
    }
}