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#[cfg(feature = "starknet")]
11pub mod starknet;
12
13// Telemetry init through OTEL
14#[cfg(feature = "telemetry")]
15pub mod telemetry;
16
17// Orderbook
18pub mod orderbook;
19
20// Pair
21pub mod pair;
22pub use pair::Pair;
23
24// Types of instrument supported, i.e spot, perp etc.
25pub mod instrument_type;
26pub use instrument_type::{InstrumentType, InstrumentTypeError};
27
28// Pragma Aggregations
29pub mod aggregation;
30pub use aggregation::AggregationMode;
31
32// An util to manage multiple tasks gracefully
33#[cfg(feature = "services")]
34pub mod services;
35
36// A structure allowing us to have multiple handles dependent on each others.
37#[cfg(feature = "task-group")]
38pub mod task_group;
39
40// Pragma Time Intervals
41pub mod interval;
42pub use interval::Interval;
43
44// Capnp generated schema. Only related to `entries`.
45#[cfg(feature = "capnp")]
46mod schema_capnp {
47    include!(concat!(env!("OUT_DIR"), "/schema_capnp.rs"));
48}
49
50// Used to serialize a struct into a payload with capnp.
51#[cfg(feature = "capnp")]
52pub trait CapnpSerialize {
53    fn to_capnp(&self) -> Vec<u8>;
54}
55
56// Used to deserialize a capnp payload into a struct.
57#[cfg(feature = "capnp")]
58pub trait CapnpDeserialize {
59    fn from_capnp(bytes: &[u8]) -> Result<Self, capnp::Error>
60    where
61        Self: Sized;
62}