1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
//! Crypto-bank RPC service primitives.

use async_trait::async_trait;

use cxmr_exchanges::Market;
use cxmr_orderbook::OrderBook;

/// Service trait.
#[async_trait]
pub trait Service: Send + Sync {
    /// Service error type.
    type Error;

    /// Returns all orderbooks in the service.
    async fn orderbooks(&self) -> Result<Vec<(Market, OrderBook)>, Self::Error>;
}

/// Shared service client type alias.
pub type SharedService<E> = Box<dyn Service<Error = E>>;