#[repr(C)]pub struct LeafNode {}
Expand description
LeafNodes represent an order in the binary tree
Fields
tag: u8
NodeTag
owner_slot: u8
Index into the owning MangoAccount’s PerpOpenOrders
order_type: u8
PostOrderType, this was added for TradingView move order
padding: [u8; 1]
time_in_force: u16
Time in seconds after timestamp
at which the order expires.
A value of 0 means no expiry.
padding2: [u8; 2]
key: u128
The binary tree key, see new_node_key()
owner: Pubkey
Address of the owning MangoAccount
quantity: i64
Number of base lots to buy or sell, always >=1
timestamp: u64
The time the order was placed
peg_limit: i64
If the effective price of an oracle pegged order exceeds this limit, it will be considered invalid and may be removed.
Only applicable in the oracle_pegged OrderTree
client_order_id: u64
User defined id for this order, used in FillEvents
reserved: [u8; 32]
Implementations
sourceimpl LeafNode
impl LeafNode
pub fn new(
owner_slot: u8,
key: u128,
owner: Pubkey,
quantity: i64,
timestamp: u64,
order_type: PostOrderType,
time_in_force: u16,
peg_limit: i64,
client_order_id: u64
) -> Self
sourcepub fn price_data(&self) -> u64
pub fn price_data(&self) -> u64
The order’s price_data as stored in the key
Needs to be unpacked differently for fixed and oracle pegged orders.
sourcepub fn is_expired(&self, now_ts: u64) -> bool
pub fn is_expired(&self, now_ts: u64) -> bool
Returns if the order is expired at now_ts
Trait Implementations
sourceimpl BorshDeserialize for LeafNodewhere
u8: BorshDeserialize,
u8: BorshDeserialize,
u8: BorshDeserialize,
[u8; 1]: BorshDeserialize,
u16: BorshDeserialize,
[u8; 2]: BorshDeserialize,
u128: BorshDeserialize,
Pubkey: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
[u8; 32]: BorshDeserialize,
impl BorshDeserialize for LeafNodewhere
u8: BorshDeserialize,
u8: BorshDeserialize,
u8: BorshDeserialize,
[u8; 1]: BorshDeserialize,
u16: BorshDeserialize,
[u8; 2]: BorshDeserialize,
u128: BorshDeserialize,
Pubkey: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
i64: BorshDeserialize,
u64: BorshDeserialize,
[u8; 32]: BorshDeserialize,
sourcefn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
sourceimpl BorshSerialize for LeafNodewhere
u8: BorshSerialize,
u8: BorshSerialize,
u8: BorshSerialize,
[u8; 1]: BorshSerialize,
u16: BorshSerialize,
[u8; 2]: BorshSerialize,
u128: BorshSerialize,
Pubkey: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
[u8; 32]: BorshSerialize,
impl BorshSerialize for LeafNodewhere
u8: BorshSerialize,
u8: BorshSerialize,
u8: BorshSerialize,
[u8; 1]: BorshSerialize,
u16: BorshSerialize,
[u8; 2]: BorshSerialize,
u128: BorshSerialize,
Pubkey: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
i64: BorshSerialize,
u64: BorshSerialize,
[u8; 32]: BorshSerialize,
impl Copy for LeafNode
impl Eq for LeafNode
impl Pod for LeafNode
impl StructuralEq for LeafNode
impl StructuralPartialEq for LeafNode
Auto Trait Implementations
impl RefUnwindSafe for LeafNode
impl Send for LeafNode
impl Sync for LeafNode
impl Unpin for LeafNode
impl UnwindSafe for LeafNode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
. Read morefn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.