Skip to main content

PositionStateMut

Trait PositionStateMut 

Source
pub trait PositionStateMut<const DECIMALS: u8>: PositionState<DECIMALS> {
    // Required methods
    fn collateral_amount_mut(&mut self) -> &mut Self::Num;
    fn size_in_usd_mut(&mut self) -> &mut Self::Num;
    fn size_in_tokens_mut(&mut self) -> &mut Self::Num;
    fn borrowing_factor_mut(&mut self) -> &mut Self::Num;
    fn funding_fee_amount_per_size_mut(&mut self) -> &mut Self::Num;
    fn claimable_funding_fee_amount_per_size_mut(
        &mut self,
        is_long_collateral: bool,
    ) -> &mut Self::Num;
}
Expand description

Mutable access to the position state.

Required Methods§

Source

fn collateral_amount_mut(&mut self) -> &mut Self::Num

Get a mutable reference to the collateral amount.

Source

fn size_in_usd_mut(&mut self) -> &mut Self::Num

Get a mutable reference to the size (in USD) of the position.

Source

fn size_in_tokens_mut(&mut self) -> &mut Self::Num

Get a mutable reference to the size (in tokens) of the position.

Source

fn borrowing_factor_mut(&mut self) -> &mut Self::Num

Get a mutable reference to last borrowing factor applied by the position.

Source

fn funding_fee_amount_per_size_mut(&mut self) -> &mut Self::Num

Get a mutable reference to the funding fee amount per size.

Source

fn claimable_funding_fee_amount_per_size_mut( &mut self, is_long_collateral: bool, ) -> &mut Self::Num

Get a mutable reference to claimable funding fee amount per size of the given collateral.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<const DECIMALS: u8, P: PositionStateMut<DECIMALS>> PositionStateMut<DECIMALS> for &mut P

Source§

fn collateral_amount_mut(&mut self) -> &mut Self::Num

Source§

fn size_in_usd_mut(&mut self) -> &mut Self::Num

Source§

fn size_in_tokens_mut(&mut self) -> &mut Self::Num

Source§

fn borrowing_factor_mut(&mut self) -> &mut Self::Num

Source§

fn funding_fee_amount_per_size_mut(&mut self) -> &mut Self::Num

Source§

fn claimable_funding_fee_amount_per_size_mut( &mut self, is_long_collateral: bool, ) -> &mut Self::Num

Implementors§

Source§

impl<T, const DECIMALS: u8> PositionStateMut<DECIMALS> for TestPositionOps<'_, T, DECIMALS>
where T: CheckedSub + Display + FixedPointOps<DECIMALS>, T::Signed: Num + Debug,

Available on crate features test only.