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// A structure allowing us to have multiple handles dependent on each others.
35#[cfg(feature = "task-group")]
36pub mod task_group;
37
38// Pragma Time Intervals
39pub mod interval;
40pub use interval::Interval;
41
42// Capnp generated schema. Only related to `entries`.
43#[cfg(feature = "capnp")]
44mod schema_capnp {
45    include!(concat!(env!("OUT_DIR"), "/schema_capnp.rs"));
46}
47
48// Used to serialize a struct into a payload with capnp.
49#[cfg(feature = "capnp")]
50pub trait CapnpSerialize {
51    fn to_capnp(&self) -> Vec<u8>;
52}
53
54// Used to deserialize a capnp payload into a struct.
55#[cfg(feature = "capnp")]
56pub trait CapnpDeserialize {
57    fn from_capnp(bytes: &[u8]) -> Result<Self, capnp::Error>
58    where
59        Self: Sized;
60}