pub struct Pips(/* private fields */);Expand description
1 pip == 1/100th of bip == 0.0001%
Implementations§
Source§impl Pips
impl Pips
pub const ZERO: Self
pub const ONE_PIP: Self
pub const ONE_BIP: Self
pub const ONE_PERCENT: Self
pub const MAX: Self
pub const fn from_pips(pips: u32) -> Option<Self>
pub const fn from_bips(bips: u32) -> Option<Self>
pub const fn from_percent(percent: u32) -> Option<Self>
pub const fn as_pips(self) -> u32
pub const fn as_bips(self) -> u32
pub const fn as_percent(self) -> u32
pub const fn is_zero(&self) -> bool
pub fn as_f64(self) -> f64
pub const fn checked_add(self, rhs: Self) -> Option<Self>
pub const fn checked_sub(self, rhs: Self) -> Option<Self>
pub const fn checked_mul(self, rhs: u32) -> Option<Self>
pub const fn checked_div(self, rhs: u32) -> Option<Self>
pub const fn invert(self) -> Self
pub fn fee(self, amount: u128) -> u128
pub fn fee_ceil(self, amount: u128) -> u128
Trait Implementations§
Source§impl BorshDeserialize for Pips
impl BorshDeserialize for Pips
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl<'de> Deserialize<'de> for Pips
impl<'de> Deserialize<'de> for Pips
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Pips
impl Ord for Pips
Source§impl PartialOrd for Pips
impl PartialOrd for Pips
impl Copy for Pips
impl Eq for Pips
impl StructuralPartialEq for Pips
Auto Trait Implementations§
impl Freeze for Pips
impl RefUnwindSafe for Pips
impl Send for Pips
impl Sync for Pips
impl Unpin for Pips
impl UnwindSafe for Pips
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more