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>>

source

pub fn from_bytes(bytes: &[u8]) -> Result<Self>

source§

impl<'a> DynamicAccount<MangoAccountDynamicHeader, &'a MangoAccountFixed, &'a [u8]>

source

pub fn from_bytes(bytes: &'a [u8]) -> Result<Self>

source§

impl<Header: DerefOrBorrow<MangoAccountDynamicHeader>, Fixed: DerefOrBorrow<MangoAccountFixed>, Dynamic: DerefOrBorrow<[u8]>> DynamicAccount<Header, Fixed, Dynamic>

source

pub fn header_version(&self) -> &u8

source

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)
source

pub fn token_position(&self, token_index: TokenIndex) -> Result<&TokenPosition>

source

pub fn token_position_by_raw_index(&self, raw_index: usize) -> &TokenPosition

source

pub fn all_token_positions(&self) -> impl Iterator<Item = &TokenPosition> + '_

source

pub fn active_token_positions( &self ) -> impl Iterator<Item = &TokenPosition> + '_

source

pub fn serum3_orders( &self, market_index: Serum3MarketIndex ) -> Result<&Serum3Orders>

source

pub fn serum3_orders_by_raw_index(&self, raw_index: usize) -> &Serum3Orders

source

pub fn all_serum3_orders(&self) -> impl Iterator<Item = &Serum3Orders> + '_

source

pub fn active_serum3_orders(&self) -> impl Iterator<Item = &Serum3Orders> + '_

source

pub fn perp_position( &self, market_index: PerpMarketIndex ) -> Result<&PerpPosition>

source

pub fn perp_position_by_raw_index(&self, raw_index: usize) -> &PerpPosition

source

pub fn all_perp_positions(&self) -> impl Iterator<Item = &PerpPosition>

source

pub fn active_perp_positions(&self) -> impl Iterator<Item = &PerpPosition>

source

pub fn perp_order_by_raw_index(&self, raw_index: usize) -> &PerpOpenOrder

source

pub fn all_perp_orders(&self) -> impl Iterator<Item = &PerpOpenOrder>

source

pub fn perp_next_order_slot(&self) -> Result<usize>

source

pub fn perp_find_order_with_client_order_id( &self, market_index: PerpMarketIndex, client_order_id: u64 ) -> Option<&PerpOpenOrder>

source

pub fn perp_find_order_with_order_id( &self, market_index: PerpMarketIndex, order_id: u128 ) -> Option<&PerpOpenOrder>

source

pub fn being_liquidated(&self) -> bool

source

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>

source

pub fn borrow_mut(&mut self) -> MangoAccountRefMut<'_>

source

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)
source

pub fn token_position_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut TokenPosition

source

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
source

pub fn deactivate_token_position(&mut self, raw_index: usize)

source

pub fn deactivate_token_position_and_log( &mut self, raw_index: usize, mango_account_pubkey: Pubkey )

source

pub fn serum3_orders_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut Serum3Orders

source

pub fn create_serum3_orders( &mut self, market_index: Serum3MarketIndex ) -> Result<&mut Serum3Orders>

source

pub fn deactivate_serum3_orders( &mut self, market_index: Serum3MarketIndex ) -> Result<()>

source

pub fn serum3_orders_mut( &mut self, market_index: Serum3MarketIndex ) -> Result<&mut Serum3Orders>

source

pub fn perp_position_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut PerpPosition

source

pub fn perp_order_mut_by_raw_index( &mut self, raw_index: usize ) -> &mut PerpOpenOrder

source

pub fn perp_position_mut( &mut self, market_index: PerpMarketIndex ) -> Result<&mut PerpPosition>

source

pub fn ensure_perp_position( &mut self, perp_market_index: PerpMarketIndex, settle_token_index: TokenIndex ) -> Result<(&mut PerpPosition, usize)>

source

pub fn deactivate_perp_position( &mut self, perp_market_index: PerpMarketIndex, settle_token_index: TokenIndex ) -> Result<()>

source

pub fn deactivate_perp_position_and_log( &mut self, perp_market_index: PerpMarketIndex, settle_token_index: TokenIndex, mango_account_pubkey: Pubkey ) -> Result<()>

source

pub fn add_perp_order( &mut self, perp_market_index: PerpMarketIndex, side: Side, order_tree: BookSideOrderTree, order: &LeafNode, client_order_id: u64 ) -> Result<()>

source

pub fn remove_perp_order(&mut self, slot: usize, quantity: i64) -> Result<()>

source

pub fn execute_perp_maker( &mut self, perp_market_index: PerpMarketIndex, perp_market: &mut PerpMarket, fill: &FillEvent ) -> Result<()>

source

pub fn execute_perp_taker( &mut self, perp_market_index: PerpMarketIndex, perp_market: &mut PerpMarket, fill: &FillEvent ) -> Result<()>

source

pub fn check_health_pre(&mut self, health_cache: &HealthCache) -> Result<I80F48>

source

pub fn check_health_post( &mut self, health_cache: &HealthCache, pre_init_health: I80F48 ) -> Result<()>

source

pub fn check_liquidatable( &mut self, health_cache: &HealthCache ) -> Result<CheckLiquidatable>

source

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>

source§

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)

Performs copy-assignment from source. Read more

Auto 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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

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>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

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>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.