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