Skip to main content

BookError

Enum BookError 

Source
pub enum BookError {
Show 13 variants InvalidConfig { field: &'static str, rule: &'static str, }, InvalidOrderId { order_id: OrderId, }, DuplicateOrderId { order_id: OrderId, }, InvalidQuantity { qty: u64, }, InvalidPriceTick { price: u64, tick_size: u64, grid_start_tick: u64, grid_len: u32, }, OrderNotFound { order_id: OrderId, }, CapacityFull { max_orders: u32, }, LookupCapacityFull { capacity: usize, len: usize, }, PostOnlyWouldCross { price: u64, opposite_best: u64, }, FokInsufficientLiquidity { requested: u64, available: u64, }, AmendWouldCross { order_id: OrderId, new_price: u64, opposite_best: u64, }, EventBufferFull { needed: usize, available: usize, }, ArithmeticOverflow { what: &'static str, },
}
Expand description

Errors returned by book construction and by every book command.

Commands that return an error have mutated nothing: no order, level aggregate, bitmap bit, lookup entry, or sequence number changes when any of these is returned (INV-ORD-4).

Variants§

§

InvalidConfig

BookConfig failed validation at construction.

Fields

§field: &'static str

The field that failed validation.

§rule: &'static str

The rule the field violated.

§

InvalidOrderId

An order id of zero was supplied; zero is the lookup sentinel.

Fields

§order_id: OrderId

The offending order id (always zero).

§

DuplicateOrderId

An active order already uses this id.

Fields

§order_id: OrderId

The conflicting order id.

§

InvalidQuantity

A quantity of zero was supplied on add or amend.

Fields

§qty: u64

The offending quantity (always zero).

§

InvalidPriceTick

A price failed the tick grid rules of ARCHITECTURE.md section 3.2.

Fields

§price: u64

The raw price supplied, in quote units.

§tick_size: u64

Configured quote units per tick.

§grid_start_tick: u64

Configured tick value of grid index 0.

§grid_len: u32

Configured number of ticks on the grid.

§

OrderNotFound

Cancel or amend named an order that is not live.

Fields

§order_id: OrderId

The order id that was not found.

§

CapacityFull

The arena has no free slot for an order that would rest.

Fields

§max_orders: u32

Configured arena capacity.

§

LookupCapacityFull

The lookup table reached its 50 percent load cap. Defensive: the arena cap is enforced first, so this guards the table invariant directly rather than relying on that ordering.

Fields

§capacity: usize

Table capacity in buckets.

§len: usize

Entries present when the insert was refused.

§

PostOnlyWouldCross

A Post-Only order price would cross the opposite best price.

Fields

§price: u64

The raw price of the incoming order.

§opposite_best: u64

The raw opposite best price it would have crossed.

§

FokInsufficientLiquidity

A Fill-or-Kill order could not be filled in full.

Fields

§requested: u64

Quantity the order requested.

§available: u64

STP-adjusted executable quantity found in preflight.

§

AmendWouldCross

An amend would leave the book crossed.

Fields

§order_id: OrderId

The order being amended.

§new_price: u64

The raw new price requested.

§opposite_best: u64

The raw opposite best price it would cross.

§

EventBufferFull

The caller event buffer is smaller than the preflight worst-case event count for this command. Returned before any mutation, so the identical command can be retried with a larger buffer.

Fields

§needed: usize

Worst-case events the command could emit.

§available: usize

Free slots the buffer actually had.

§

ArithmeticOverflow

A checked aggregate operation overflowed. Defensive guard: aggregates are sized so this is unreachable in a valid book.

Fields

§what: &'static str

What was being computed when the overflow was detected.

Trait Implementations§

Source§

impl Clone for BookError

Source§

fn clone(&self) -> Self

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 Debug for BookError

Source§

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

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

impl Display for BookError

Source§

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

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

impl Eq for BookError

Source§

impl Error for BookError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for BookError

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BookError

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.