pragma_common/
lib.rs

1//! pragma-common
2//! Main types used through our rust projects at Pragma.
3// Web3 types
4pub mod web3;
5
6// Entries retrieved through different markets.
7// This is the data that we'll push in our internal Kafka.
8pub mod entries;
9
10// Telemetry init through OTEL
11#[cfg(feature = "telemetry")]
12pub mod telemetry;
13
14// Pair
15pub mod pair;
16pub use pair::Pair;
17
18// A complete managed Orderbook.
19pub mod orderbook;
20pub use orderbook::{Orderbook, OrderbookError};
21
22// Types of instrument supported, i.e spot, perp etc.
23pub mod instrument_type;
24pub use instrument_type::{InstrumentType, InstrumentTypeError};
25
26// Pragma Aggregations
27pub mod aggregation;
28pub use aggregation::AggregationMode;
29
30// An util to manage multiple tasks gracefully
31#[cfg(feature = "services")]
32pub mod services;
33
34// Pragma Time Intervals
35pub mod interval;
36pub use interval::Interval;
37
38// Capnp generated schema. Only related to `entries`.
39#[cfg(feature = "capnp")]
40mod schema_capnp {
41    include!(concat!(env!("OUT_DIR"), "/schema_capnp.rs"));
42}
43
44// Used to serialize a struct into a payload with capnp.
45#[cfg(feature = "capnp")]
46pub trait CapnpSerialize {
47    fn to_capnp(&self) -> Vec<u8>;
48}
49
50// Used to deserialize a capnp payload into a struct.
51#[cfg(feature = "capnp")]
52pub trait CapnpDeserialize {
53    fn from_capnp(bytes: &[u8]) -> Result<Self, capnp::Error>
54    where
55        Self: Sized;
56}