Struct decimal_percentage::Percentage
source · pub struct Percentage(/* private fields */);
Expand description
Percentage Type
- Example:
let p1 = Percentage::from(0.1f64);
let p2 = Percentage::from(0.1f32);
let p3 = Percentage::try_from("0.1").unwrap();
assert_eq!(p1 + p2, Percentage::from(0.2));
assert_eq!(p1 + 0.2, Percentage::from(0.3));
Trait Implementations§
source§impl Add<Decimal> for Percentage
impl Add<Decimal> for Percentage
source§impl Add<Percentage> for Decimal
impl Add<Percentage> for Decimal
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for f32
impl Add<Percentage> for f32
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for f64
impl Add<Percentage> for f64
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for i16
impl Add<Percentage> for i16
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for i32
impl Add<Percentage> for i32
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for i64
impl Add<Percentage> for i64
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for i8
impl Add<Percentage> for i8
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for isize
impl Add<Percentage> for isize
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for u16
impl Add<Percentage> for u16
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for u32
impl Add<Percentage> for u32
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for u64
impl Add<Percentage> for u64
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for u8
impl Add<Percentage> for u8
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<Percentage> for usize
impl Add<Percentage> for usize
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
+
operator.source§impl Add<f32> for Percentage
impl Add<f32> for Percentage
source§impl Add<f64> for Percentage
impl Add<f64> for Percentage
source§impl Add<i16> for Percentage
impl Add<i16> for Percentage
source§impl Add<i32> for Percentage
impl Add<i32> for Percentage
source§impl Add<i64> for Percentage
impl Add<i64> for Percentage
source§impl Add<i8> for Percentage
impl Add<i8> for Percentage
source§impl Add<isize> for Percentage
impl Add<isize> for Percentage
source§impl Add<u16> for Percentage
impl Add<u16> for Percentage
source§impl Add<u32> for Percentage
impl Add<u32> for Percentage
source§impl Add<u64> for Percentage
impl Add<u64> for Percentage
source§impl Add<u8> for Percentage
impl Add<u8> for Percentage
source§impl Add<usize> for Percentage
impl Add<usize> for Percentage
source§impl Add for Percentage
impl Add for Percentage
source§impl Clone for Percentage
impl Clone for Percentage
source§fn clone(&self) -> Percentage
fn clone(&self) -> Percentage
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 moresource§impl Debug for Percentage
impl Debug for Percentage
source§impl<'de> Deserialize<'de> for Percentage
impl<'de> Deserialize<'de> for Percentage
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 Display for Percentage
impl Display for Percentage
source§impl From<Decimal> for Percentage
impl From<Decimal> for Percentage
source§impl From<f32> for Percentage
impl From<f32> for Percentage
source§impl From<f64> for Percentage
impl From<f64> for Percentage
source§impl FromStr for Percentage
impl FromStr for Percentage
source§impl<'a, 'b> Mul<&'a Percentage> for &'b Percentage
impl<'a, 'b> Mul<&'a Percentage> for &'b Percentage
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
*
operator.source§impl Mul<Decimal> for Percentage
impl Mul<Decimal> for Percentage
source§impl Mul<Percentage> for Decimal
impl Mul<Percentage> for Decimal
source§impl Mul<Percentage> for f32
impl Mul<Percentage> for f32
source§impl Mul<Percentage> for f64
impl Mul<Percentage> for f64
source§impl Mul<Percentage> for i16
impl Mul<Percentage> for i16
source§impl Mul<Percentage> for i32
impl Mul<Percentage> for i32
source§impl Mul<Percentage> for i64
impl Mul<Percentage> for i64
source§impl Mul<Percentage> for i8
impl Mul<Percentage> for i8
source§impl Mul<Percentage> for isize
impl Mul<Percentage> for isize
source§impl Mul<Percentage> for u16
impl Mul<Percentage> for u16
source§impl Mul<Percentage> for u32
impl Mul<Percentage> for u32
source§impl Mul<Percentage> for u64
impl Mul<Percentage> for u64
source§impl Mul<Percentage> for u8
impl Mul<Percentage> for u8
source§impl Mul<Percentage> for usize
impl Mul<Percentage> for usize
source§impl Mul<f32> for Percentage
impl Mul<f32> for Percentage
source§impl Mul<f64> for Percentage
impl Mul<f64> for Percentage
source§impl Mul<i16> for Percentage
impl Mul<i16> for Percentage
source§impl Mul<i32> for Percentage
impl Mul<i32> for Percentage
source§impl Mul<i64> for Percentage
impl Mul<i64> for Percentage
source§impl Mul<i8> for Percentage
impl Mul<i8> for Percentage
source§impl Mul<isize> for Percentage
impl Mul<isize> for Percentage
source§impl Mul<u16> for Percentage
impl Mul<u16> for Percentage
source§impl Mul<u32> for Percentage
impl Mul<u32> for Percentage
source§impl Mul<u64> for Percentage
impl Mul<u64> for Percentage
source§impl Mul<u8> for Percentage
impl Mul<u8> for Percentage
source§impl Mul<usize> for Percentage
impl Mul<usize> for Percentage
source§impl Mul for Percentage
impl Mul for Percentage
source§impl Ord for Percentage
impl Ord for Percentage
source§fn cmp(&self, other: &Percentage) -> Ordering
fn cmp(&self, other: &Percentage) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for Percentage
impl PartialEq for Percentage
source§fn eq(&self, other: &Percentage) -> bool
fn eq(&self, other: &Percentage) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Percentage
impl PartialOrd for Percentage
source§fn partial_cmp(&self, other: &Percentage) -> Option<Ordering>
fn partial_cmp(&self, other: &Percentage) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for Percentage
impl Serialize for Percentage
source§impl Sub<Percentage> for f32
impl Sub<Percentage> for f32
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for f64
impl Sub<Percentage> for f64
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for i16
impl Sub<Percentage> for i16
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for i32
impl Sub<Percentage> for i32
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for i64
impl Sub<Percentage> for i64
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for i8
impl Sub<Percentage> for i8
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for isize
impl Sub<Percentage> for isize
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for u16
impl Sub<Percentage> for u16
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for u32
impl Sub<Percentage> for u32
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for u64
impl Sub<Percentage> for u64
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for u8
impl Sub<Percentage> for u8
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<Percentage> for usize
impl Sub<Percentage> for usize
§type Output = Percentage
type Output = Percentage
The resulting type after applying the
-
operator.source§impl Sub<f32> for Percentage
impl Sub<f32> for Percentage
source§impl Sub<f64> for Percentage
impl Sub<f64> for Percentage
source§impl Sub<i16> for Percentage
impl Sub<i16> for Percentage
source§impl Sub<i32> for Percentage
impl Sub<i32> for Percentage
source§impl Sub<i64> for Percentage
impl Sub<i64> for Percentage
source§impl Sub<i8> for Percentage
impl Sub<i8> for Percentage
source§impl Sub<isize> for Percentage
impl Sub<isize> for Percentage
source§impl Sub<u16> for Percentage
impl Sub<u16> for Percentage
source§impl Sub<u32> for Percentage
impl Sub<u32> for Percentage
source§impl Sub<u64> for Percentage
impl Sub<u64> for Percentage
source§impl Sub<u8> for Percentage
impl Sub<u8> for Percentage
source§impl Sub<usize> for Percentage
impl Sub<usize> for Percentage
source§impl Sub for Percentage
impl Sub for Percentage
source§impl TryFrom<&str> for Percentage
impl TryFrom<&str> for Percentage
impl Copy for Percentage
impl Eq for Percentage
impl StructuralEq for Percentage
impl StructuralPartialEq for Percentage
Auto Trait Implementations§
impl RefUnwindSafe for Percentage
impl Send for Percentage
impl Sync for Percentage
impl Unpin for Percentage
impl UnwindSafe for Percentage
Blanket Implementations§
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