[−][src]Struct rug::complex::OrdComplex
A complex number that supports total ordering and hashing.
For ordering, the real part has precedence over the imaginary part. Negative zero is ordered as less than positive zero. Negative NaN is ordered as less than negative infinity, while positive NaN is ordered as greater than positive infinity. Comparing two negative NaNs or two positive NaNs produces equality.
Examples
use core::cmp::Ordering; use rug::{complex::OrdComplex, float::Special, Complex}; let nan_c = Complex::with_val(53, (Special::Nan, Special::Nan)); let nan = OrdComplex::from(nan_c); assert_eq!(nan.cmp(&nan), Ordering::Equal); let one_neg0_c = Complex::with_val(53, (1, Special::NegZero)); let one_neg0 = OrdComplex::from(one_neg0_c); let one_pos0_c = Complex::with_val(53, (1, Special::Zero)); let one_pos0 = OrdComplex::from(one_pos0_c); assert_eq!(one_neg0.cmp(&one_pos0), Ordering::Less); let zero_inf_s = (Special::Zero, Special::Infinity); let zero_inf_c = Complex::with_val(53, zero_inf_s); let zero_inf = OrdComplex::from(zero_inf_c); assert_eq!(one_pos0.cmp(&zero_inf), Ordering::Greater);
Methods
impl OrdComplex
[src]
pub fn as_complex(&self) -> &Complex
[src]
Extracts the underlying Complex
.
Examples
use rug::{complex::OrdComplex, Complex}; let c = Complex::with_val(53, (1.5, 2.5)); let ord = OrdComplex::from(c); let c_ref = ord.as_complex(); assert_eq!(*c_ref.real(), 1.5); assert_eq!(*c_ref.imag(), 2.5);
pub fn as_complex_mut(&mut self) -> &mut Complex
[src]
Trait Implementations
impl Clone for OrdComplex
[src]
fn clone(&self) -> OrdComplex
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for OrdComplex
[src]
impl<'de> Deserialize<'de> for OrdComplex
[src]
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<OrdComplex, D::Error>
[src]
deserializer: D
) -> Result<OrdComplex, D::Error>
fn deserialize_in_place<D: Deserializer<'de>>(
deserializer: D,
place: &mut OrdComplex
) -> Result<(), D::Error>
[src]
deserializer: D,
place: &mut OrdComplex
) -> Result<(), D::Error>
impl Eq for OrdComplex
[src]
impl From<Complex> for OrdComplex
[src]
impl From<OrdComplex> for Complex
[src]
fn from(src: OrdComplex) -> Self
[src]
impl Hash for OrdComplex
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for OrdComplex
[src]
fn cmp(&self, other: &OrdComplex) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<OrdComplex> for OrdComplex
[src]
fn eq(&self, other: &OrdComplex) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<OrdComplex> for OrdComplex
[src]
fn partial_cmp(&self, other: &OrdComplex) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for OrdComplex
[src]
Auto Trait Implementations
impl RefUnwindSafe for OrdComplex
impl Send for OrdComplex
impl Sync for OrdComplex
impl Unpin for OrdComplex
impl UnwindSafe for OrdComplex
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Az for T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedAs for T
[src]
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
[src]
T: CheckedCast<Dst>,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> OverflowingAs for T
[src]
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
[src]
T: OverflowingCast<Dst>,
impl<T> SaturatingAs for T
[src]
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
[src]
T: SaturatingCast<Dst>,
impl<T> StaticAs for T
[src]
fn static_as<Dst>(self) -> Option<Dst> where
T: StaticCast<Dst>,
[src]
T: StaticCast<Dst>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WrappingAs for T
[src]
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
[src]
T: WrappingCast<Dst>,