Struct mango_v4::state::DynamicAccount
source · pub struct DynamicAccount<Header, Fixed, Dynamic> {
pub header: Header,
pub fixed: Fixed,
pub dynamic: Dynamic,
}
Fields§
§header: Header
§fixed: Fixed
§dynamic: Dynamic
Implementations§
source§impl DynamicAccount<MangoAccountDynamicHeader, MangoAccountFixed, Vec<u8, Global>>
impl DynamicAccount<MangoAccountDynamicHeader, MangoAccountFixed, Vec<u8, Global>>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
source§impl<'a> DynamicAccount<MangoAccountDynamicHeader, &'a MangoAccountFixed, &'a [u8]>
impl<'a> DynamicAccount<MangoAccountDynamicHeader, &'a MangoAccountFixed, &'a [u8]>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self>
source§impl<Header: DerefOrBorrow<MangoAccountDynamicHeader>, Fixed: DerefOrBorrow<MangoAccountFixed>, Dynamic: DerefOrBorrow<[u8]>> DynamicAccount<Header, Fixed, Dynamic>
impl<Header: DerefOrBorrow<MangoAccountDynamicHeader>, Fixed: DerefOrBorrow<MangoAccountFixed>, Dynamic: DerefOrBorrow<[u8]>> DynamicAccount<Header, Fixed, Dynamic>
pub fn header_version(&self) -> &u8
sourcepub fn token_position_and_raw_index(
&self,
token_index: TokenIndex
) -> Result<(&TokenPosition, usize)>
pub fn token_position_and_raw_index( &self, token_index: TokenIndex ) -> Result<(&TokenPosition, usize)>
Returns
- the position
- the raw index into the token positions list (for use with get_raw/deactivate)
pub fn token_position(&self, token_index: TokenIndex) -> Result<&TokenPosition>
pub fn token_position_by_raw_index(&self, raw_index: usize) -> &TokenPosition
pub fn all_token_positions(&self) -> impl Iterator<Item = &TokenPosition> + '_
pub fn active_token_positions( &self ) -> impl Iterator<Item = &TokenPosition> + '_
pub fn serum3_orders( &self, market_index: Serum3MarketIndex ) -> Result<&Serum3Orders>
pub fn serum3_orders_by_raw_index(&self, raw_index: usize) -> &Serum3Orders
pub fn all_serum3_orders(&self) -> impl Iterator<Item = &Serum3Orders> + '_
pub fn active_serum3_orders(&self) -> impl Iterator<Item = &Serum3Orders> + '_
pub fn perp_position( &self, market_index: PerpMarketIndex ) -> Result<&PerpPosition>
pub fn perp_position_by_raw_index(&self, raw_index: usize) -> &PerpPosition
pub fn all_perp_positions(&self) -> impl Iterator<Item = &PerpPosition>
pub fn active_perp_positions(&self) -> impl Iterator<Item = &PerpPosition>
pub fn perp_order_by_raw_index(&self, raw_index: usize) -> &PerpOpenOrder
pub fn all_perp_orders(&self) -> impl Iterator<Item = &PerpOpenOrder>
pub fn perp_next_order_slot(&self) -> Result<usize>
pub fn perp_find_order_with_client_order_id( &self, market_index: PerpMarketIndex, client_order_id: u64 ) -> Option<&PerpOpenOrder>
pub fn perp_find_order_with_order_id( &self, market_index: PerpMarketIndex, order_id: u128 ) -> Option<&PerpOpenOrder>
pub fn being_liquidated(&self) -> bool
pub fn borrow(&self) -> MangoAccountRef<'_>
source§impl<Header: DerefOrBorrowMut<MangoAccountDynamicHeader> + DerefOrBorrow<MangoAccountDynamicHeader>, Fixed: DerefOrBorrowMut<MangoAccountFixed> + DerefOrBorrow<MangoAccountFixed>, Dynamic: DerefOrBorrowMut<[u8]> + DerefOrBorrow<[u8]>> DynamicAccount<Header, Fixed, Dynamic>
impl<Header: DerefOrBorrowMut<MangoAccountDynamicHeader> + DerefOrBorrow<MangoAccountDynamicHeader>, Fixed: DerefOrBorrowMut<MangoAccountFixed> + DerefOrBorrow<MangoAccountFixed>, Dynamic: DerefOrBorrowMut<[u8]> + DerefOrBorrow<[u8]>> DynamicAccount<Header, Fixed, Dynamic>
pub fn borrow_mut(&mut self) -> MangoAccountRefMut<'_>
sourcepub fn token_position_mut(
&mut self,
token_index: TokenIndex
) -> Result<(&mut TokenPosition, usize)>
pub fn token_position_mut( &mut self, token_index: TokenIndex ) -> Result<(&mut TokenPosition, usize)>
Returns
- the position
- the raw index into the token positions list (for use with get_raw/deactivate)
pub fn token_position_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut TokenPosition
sourcepub fn ensure_token_position(
&mut self,
token_index: TokenIndex
) -> Result<(&mut TokenPosition, usize, usize)>
pub fn ensure_token_position( &mut self, token_index: TokenIndex ) -> Result<(&mut TokenPosition, usize, usize)>
Creates or retrieves a TokenPosition for the token_index. Returns:
- the position
- the raw index into the token positions list (for use with get_raw)
- the active index, for use with FixedOrderAccountRetriever
pub fn deactivate_token_position(&mut self, raw_index: usize)
pub fn deactivate_token_position_and_log( &mut self, raw_index: usize, mango_account_pubkey: Pubkey )
pub fn serum3_orders_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut Serum3Orders
pub fn create_serum3_orders( &mut self, market_index: Serum3MarketIndex ) -> Result<&mut Serum3Orders>
pub fn deactivate_serum3_orders( &mut self, market_index: Serum3MarketIndex ) -> Result<()>
pub fn serum3_orders_mut( &mut self, market_index: Serum3MarketIndex ) -> Result<&mut Serum3Orders>
pub fn perp_position_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut PerpPosition
pub fn perp_order_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut PerpOpenOrder
pub fn perp_position_mut( &mut self, market_index: PerpMarketIndex ) -> Result<&mut PerpPosition>
pub fn ensure_perp_position( &mut self, perp_market_index: PerpMarketIndex, settle_token_index: TokenIndex ) -> Result<(&mut PerpPosition, usize)>
pub fn deactivate_perp_position( &mut self, perp_market_index: PerpMarketIndex, settle_token_index: TokenIndex ) -> Result<()>
pub fn deactivate_perp_position_and_log( &mut self, perp_market_index: PerpMarketIndex, settle_token_index: TokenIndex, mango_account_pubkey: Pubkey ) -> Result<()>
pub fn add_perp_order( &mut self, perp_market_index: PerpMarketIndex, side: Side, order_tree: BookSideOrderTree, order: &LeafNode, client_order_id: u64 ) -> Result<()>
pub fn remove_perp_order(&mut self, slot: usize, quantity: i64) -> Result<()>
pub fn execute_perp_maker( &mut self, perp_market_index: PerpMarketIndex, perp_market: &mut PerpMarket, fill: &FillEvent ) -> Result<()>
pub fn execute_perp_taker( &mut self, perp_market_index: PerpMarketIndex, perp_market: &mut PerpMarket, fill: &FillEvent ) -> Result<()>
pub fn check_health_pre(&mut self, health_cache: &HealthCache) -> Result<I80F48>
pub fn check_health_post( &mut self, health_cache: &HealthCache, pre_init_health: I80F48 ) -> Result<()>
pub fn check_liquidatable( &mut self, health_cache: &HealthCache ) -> Result<CheckLiquidatable>
pub fn expand_dynamic_content( &mut self, new_token_count: u8, new_serum3_count: u8, new_perp_count: u8, new_perp_oo_count: u8 ) -> Result<()>
Trait Implementations§
source§impl<Header: Clone, Fixed: Clone, Dynamic: Clone> Clone for DynamicAccount<Header, Fixed, Dynamic>
impl<Header: Clone, Fixed: Clone, Dynamic: Clone> Clone for DynamicAccount<Header, Fixed, Dynamic>
source§fn clone(&self) -> DynamicAccount<Header, Fixed, Dynamic>
fn clone(&self) -> DynamicAccount<Header, Fixed, Dynamic>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<Header, Fixed, Dynamic> RefUnwindSafe for DynamicAccount<Header, Fixed, Dynamic>where Dynamic: RefUnwindSafe, Fixed: RefUnwindSafe, Header: RefUnwindSafe,
impl<Header, Fixed, Dynamic> Send for DynamicAccount<Header, Fixed, Dynamic>where Dynamic: Send, Fixed: Send, Header: Send,
impl<Header, Fixed, Dynamic> Sync for DynamicAccount<Header, Fixed, Dynamic>where Dynamic: Sync, Fixed: Sync, Header: Sync,
impl<Header, Fixed, Dynamic> Unpin for DynamicAccount<Header, Fixed, Dynamic>where Dynamic: Unpin, Fixed: Unpin, Header: Unpin,
impl<Header, Fixed, Dynamic> UnwindSafe for DynamicAccount<Header, Fixed, Dynamic>where Dynamic: UnwindSafe, Fixed: UnwindSafe, Header: UnwindSafe,
Blanket Implementations§
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.