Skip to main content

FlagSet

Struct FlagSet 

Source
pub struct FlagSet { /* private fields */ }
Expand description

A transparent wrapper around the bit field used in several DBN record types, namely MboMsg and record types derived from it.

Most operations support constant evaluation, e.g.

use dbn::FlagSet;

const FLAGS: FlagSet = FlagSet::empty().set_snapshot().set_last();

Implementations§

Source§

impl FlagSet

Source

pub const fn empty() -> Self

Returns an empty FlagSet: one with no flags set.

Source

pub const fn new(raw: u8) -> Self

Creates a new flag set from raw.

Source

pub const fn clear(&mut self) -> &mut Self

Turns all flags off, i.e. to false.

Source

pub const fn raw(&self) -> u8

Returns the raw value.

Source

pub const fn set_raw(&mut self, raw: u8)

Sets the flags directly with a raw u8.

Source

pub const fn any(&self) -> bool

Returns true if any of the flags are on or set to true.

Source

pub const fn is_empty(&self) -> bool

Returns true if all flags are unset/false.

Source

pub const fn is_last(&self) -> bool

Returns true if it’s the last record in the event from the venue for a given instrument_id.

Source

pub const fn set_last(&mut self) -> Self

Sets the LAST bit flag to true to indicate this is the last record in the event for a given instrument.

Source

pub const fn is_tob(&self) -> bool

Returns true if it’s a top-of-book record, not an individual order.

Source

pub const fn set_tob(&mut self) -> Self

Sets the TOB bit flag to true to indicate this is a top-of-book record.

Source

pub const fn is_snapshot(&self) -> bool

Returns true if this record was sourced from a replay, such as a snapshot server.

Source

pub const fn set_snapshot(&mut self) -> Self

Sets the SNAPSHOT bit flag to true to indicate this record was sourced from a replay.

Source

pub const fn is_mbp(&self) -> bool

Returns true if this record is an aggregated price level record, not an individual order.

Source

pub const fn set_mbp(&mut self) -> Self

Sets the MBP bit flag to true to indicate this record is an aggregated price level record.

Source

pub const fn is_bad_ts_recv(&self) -> bool

Returns true if this record has an inaccurate ts_recv value due to clock issues or packet reordering.

Source

pub const fn set_bad_ts_recv(&mut self) -> Self

Sets the BAD_TS_RECV bit flag to true to indicate this record has an inaccurate ts_recv value.

Source

pub const fn is_maybe_bad_book(&self) -> bool

Returns true if this record is from a channel where an unrecoverable gap was detected.

Source

pub const fn set_maybe_bad_book(&mut self) -> Self

Sets the MAYBE_BAD_BOOK bit flag to true to indicate this record is from a channel where an unrecoverable gap was detected.

Source

pub const fn is_publisher_specific(&self) -> bool

Returns true if this record has the publisher-specific flag set.

Source

pub const fn set_publisher_specific(&mut self) -> Self

Sets the PUBLISHER_SPECIFIC bit flag to true.

Trait Implementations§

Source§

impl Clone for FlagSet

Source§

fn clone(&self) -> FlagSet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FlagSet

Source§

impl Debug for FlagSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FlagSet

Source§

fn default() -> FlagSet

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for FlagSet

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for FlagSet

Source§

impl From<u8> for FlagSet

Source§

fn from(raw: u8) -> Self

Converts to this type from the input type.
Source§

impl<'py> FromPyObject<'_, 'py> for FlagSet

Source§

type Error = PyErr

The type returned in the event of a conversion error. Read more
Source§

fn extract(obj: Borrowed<'_, 'py, PyAny>) -> Result<Self, PyErr>

Extracts Self from the bound smart pointer obj. Read more
Source§

impl Hash for FlagSet

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'py> IntoPyObject<'py> for FlagSet

Available on crate feature python only.
Source§

type Target = PyInt

The Python output type
Source§

type Output = Bound<'py, <FlagSet as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error>

Performs the conversion.
Source§

impl Ord for FlagSet

Source§

fn cmp(&self, other: &FlagSet) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FlagSet

Source§

fn eq(&self, other: &FlagSet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for FlagSet

Source§

fn partial_cmp(&self, other: &FlagSet) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for FlagSet

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FlagSet

Source§

impl WritePyRepr for FlagSet

Available on crate feature python only.
Source§

fn write_py_repr(&self, s: &mut String) -> Result

Writes a Python-style string representation to s. Read more
Source§

const SHOULD_FLATTEN: bool = false

Whether this type’s fields should be flattened into the parent repr.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'py, T> FromPyObjectOwned<'py> for T
where T: for<'a> FromPyObject<'a, 'py>,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

Source§

fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>

Converts self into an owned Python object, dropping type information.
Source§

fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>

Converts self into an owned Python object, dropping type information and unbinding it from the 'py lifetime.
Source§

fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>

Converts self into a Python object. Read more
Source§

impl<T> PyErrArguments for T
where T: for<'py> IntoPyObject<'py> + Send + Sync,

Source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,