Trait StatRec

Source
pub trait StatRec: HasRType {
    const UNDEF_STAT_QUANTITY: i64;

    // Required methods
    fn stat_type(&self) -> Result<StatType>;
    fn ts_recv(&self) -> Option<OffsetDateTime>;
    fn ts_ref(&self) -> Option<OffsetDateTime>;
    fn update_action(&self) -> Result<StatUpdateAction>;
    fn price(&self) -> i64;
    fn quantity(&self) -> i64;
}
Expand description

A trait for compatibility between different versions of statistics records.

Required Associated Constants§

Source

const UNDEF_STAT_QUANTITY: i64

The sentinel value for a null quantity.

Required Methods§

Source

fn stat_type(&self) -> Result<StatType>

Tries to convert the raw type of the statistic value to an enum.

§Errors

This function returns an error if the stat_type field does not contain a valid StatType.

Source

fn ts_recv(&self) -> Option<OffsetDateTime>

Parses the raw capture-server-received timestamp into a datetime. Returns None if ts_recv contains the sentinel for a null timestamp.

Source

fn ts_ref(&self) -> Option<OffsetDateTime>

Parses the raw reference timestamp of the statistic value into a datetime. Returns None if ts_ref contains the sentinel for a null timestamp.

Source

fn update_action(&self) -> Result<StatUpdateAction>

Tries to convert the raw update_action to an enum.

§Errors

This function returns an error if the update_action field does not contain a valid StatUpdateAction.

Source

fn price(&self) -> i64

The value for price statistics expressed as a signed integer where every 1 unit corresponds to 1e-9, i.e. 1/1,000,000,000 or 0.000000001. Will be UNDEF_PRICE when unused.

Source

fn quantity(&self) -> i64

The value for quantity statistics. Will be UNDEF_STAT_QUANTITY when unused.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl StatRec for dbn::record::StatMsg

Source§

const UNDEF_STAT_QUANTITY: i64 = 9_223_372_036_854_775_807i64

Source§

impl StatRec for dbn::compat::StatMsgV1

Source§

const UNDEF_STAT_QUANTITY: i64 = 2_147_483_647i64