Struct rill_protocol::range::Pct [−][src]
pub struct Pct(_);
Implementations
Methods from Deref<Target = f64>
pub const RADIX: u321.43.0[src]
pub const MANTISSA_DIGITS: u321.43.0[src]
pub const DIGITS: u321.43.0[src]
pub const EPSILON: f641.43.0[src]
pub const MIN: f641.43.0[src]
pub const MIN_POSITIVE: f641.43.0[src]
pub const MAX: f641.43.0[src]
pub const MIN_EXP: i321.43.0[src]
pub const MAX_EXP: i321.43.0[src]
pub const MIN_10_EXP: i321.43.0[src]
pub const MAX_10_EXP: i321.43.0[src]
pub const NAN: f641.43.0[src]
pub const INFINITY: f641.43.0[src]
pub const NEG_INFINITY: f641.43.0[src]
pub fn total_cmp(&self, other: &f64) -> Ordering[src]
🔬 This is a nightly-only experimental API. (total_cmp)
pub fn total_cmp(&self, other: &f64) -> Ordering[src]total_cmp)Returns an ordering between self and other values. Unlike the standard partial comparison between floating point numbers, this comparison always produces an ordering in accordance to the totalOrder predicate as defined in IEEE 754 (2008 revision) floating point standard. The values are ordered in following order:
- Negative quiet NaN
- Negative signaling NaN
- Negative infinity
- Negative numbers
- Negative subnormal numbers
- Negative zero
- Positive zero
- Positive subnormal numbers
- Positive numbers
- Positive infinity
- Positive signaling NaN
- Positive quiet NaN
Note that this function does not always agree with the PartialOrd
and PartialEq implementations of f64. In particular, they regard
negative and positive zero as equal, while total_cmp doesn’t.
Example
#![feature(total_cmp)] struct GoodBoy { name: String, weight: f64, } let mut bois = vec![ GoodBoy { name: "Pucci".to_owned(), weight: 0.1 }, GoodBoy { name: "Woofer".to_owned(), weight: 99.0 }, GoodBoy { name: "Yapper".to_owned(), weight: 10.0 }, GoodBoy { name: "Chonk".to_owned(), weight: f64::INFINITY }, GoodBoy { name: "Abs. Unit".to_owned(), weight: f64::NAN }, GoodBoy { name: "Floaty".to_owned(), weight: -5.0 }, ]; bois.sort_by(|a, b| a.weight.total_cmp(&b.weight));
Trait Implementations
impl<'de> Deserialize<'de> for Pct[src]
impl<'de> Deserialize<'de> for Pct[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]Deserialize this value from the given Serde deserializer. Read more
impl Copy for Pct[src]
Auto Trait Implementations
impl RefUnwindSafe for Pct
impl Send for Pct
impl Sync for Pct
impl Unpin for Pct
impl UnwindSafe for Pct
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> DataFraction for T where
T: DeserializeOwned + Serialize + Clone + Debug + Sync + Send + 'static, [src]
T: DeserializeOwned + Serialize + Clone + Debug + Sync + Send + 'static,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> ProtocolData for T where
T: Serialize + DeserializeOwned + Debug + Send + 'static, [src]
T: Serialize + DeserializeOwned + Debug + Send + 'static,