aum_engine/
lib.rs

1mod errors;
2mod executor;
3mod interface;
4mod runtime;
5pub use errors::Error;
6
7pub struct Engine;
8
9impl Engine {
10    pub async fn start<S, Wm, M>(
11        bind: &str,
12        runtime: runtime::Runtime<S, Wm, M>,
13    ) -> Result<Self, Error>
14    where
15        S: aum_core::prelude::Storage + Send + 'static + Sync,
16        Wm: aum_core::prelude::WalletManager + Send + 'static + Sync,
17        M: aum_core::prelude::Monitor<WalletManager = Wm> + Send + 'static + Sync,
18    {
19        let executor = executor::Executor::new(runtime);
20        interface::Server::new(bind, executor).await?;
21        Ok(Self {})
22    }
23}
24
25pub async fn create_runtime<S, Wm, M>(
26    storage: S,
27    wallet_manager: Wm,
28    monitor: M,
29) -> runtime::Runtime<S, Wm, M>
30where
31    S: aum_core::prelude::Storage + Send + 'static + Sync,
32    Wm: aum_core::prelude::WalletManager + Send + 'static + Sync,
33    M: aum_core::prelude::Monitor<WalletManager = Wm> + Send + 'static + Sync,
34{
35    runtime::Runtime::new(storage, wallet_manager, monitor).await
36}