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
InvalidOrderId
An order id of zero was supplied; zero is the lookup sentinel.
DuplicateOrderId
An active order already uses this id.
InvalidQuantity
A quantity of zero was supplied on add or amend.
InvalidPriceTick
A price failed the tick grid rules of ARCHITECTURE.md section 3.2.
Fields
OrderNotFound
Cancel or amend named an order that is not live.
CapacityFull
The arena has no free slot for an order that would rest.
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
PostOnlyWouldCross
A Post-Only order price would cross the opposite best price.
Fields
FokInsufficientLiquidity
A Fill-or-Kill order could not be filled in full.
Fields
AmendWouldCross
An amend would leave the book crossed.
Fields
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
ArithmeticOverflow
A checked aggregate operation overflowed. Defensive guard: aggregates are sized so this is unreachable in a valid book.
Trait Implementations§
impl Eq for BookError
Source§impl Error for BookError
impl Error for BookError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()