Struct Ppm
pub struct Ppm(/* private fields */);Expand description
A “parts per million” value for proportional fee rates.
Internally stores an i32 in the range [0, 1_000_000].
1_000_000 ppm = 100%, so 5000 ppm = 0.5%.
Implementations§
§impl Ppm
impl Ppm
pub fn try_from_decimal(rate: Decimal) -> Result<Ppm, Error>
pub fn try_from_decimal(rate: Decimal) -> Result<Ppm, Error>
pub fn try_from_percent(pct: Decimal) -> Result<Ppm, Error>
pub fn try_from_percent(pct: Decimal) -> Result<Ppm, Error>
pub const fn to_decimal(self) -> Decimal
pub const fn to_decimal(self) -> Decimal
Returns the ppm value as a Decimal rate (ppm / 1_000_000).
For example, 5000 ppm becomes 0.005 (0.5%).
pub const fn to_percent(self) -> Decimal
pub const fn to_percent(self) -> Decimal
Returns the ppm value as a Decimal percentage (ppm / 10_000).
For example, 5000 ppm becomes 0.5 (0.5%).
Trait Implementations§
§impl<'de> Deserialize<'de> for Ppm
impl<'de> Deserialize<'de> for Ppm
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Ppm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Ppm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Ord for Ppm
impl Ord for Ppm
§impl PartialOrd for Ppm
impl PartialOrd for Ppm
§impl Serialize for Ppm
impl Serialize for Ppm
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for Ppm
impl Eq for Ppm
impl StructuralPartialEq for Ppm
Auto Trait Implementations§
impl Freeze for Ppm
impl RefUnwindSafe for Ppm
impl Send for Ppm
impl Sync for Ppm
impl Unpin for Ppm
impl UnwindSafe for Ppm
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.