F64RealOrComplex

Trait F64RealOrComplex 

Source
pub trait F64RealOrComplex:
    ComplexFloat<Real: Display>
    + AddAssign
    + SubAssign
    + Display
    + MulAssign
    + DivAssign
    + Debug
    + Sealed {
    // Required methods
    fn try_from_complexf64(
        number: Complex<f64>,
    ) -> Result<Self, NotConvertibleFromComplexF64>;
    fn to_complexf64(self) -> Complex<f64>;
    fn from_f64(value: f64) -> Self;
    fn set_re_f64(&mut self, value: f64);
    fn set_im_f64(&mut self, value: f64);
    fn nth_root(self, n: i32) -> Self;
}
Expand description

This is an internal trait which is used to convert between f64 and Complex<f64>-based DynQuantity structs. It needs to be public because it is part of the type signature of DynQuantity, but it is not meant to be implemented by external types and is therefore sealed.

Required Methods§

Source

fn try_from_complexf64( number: Complex<f64>, ) -> Result<Self, NotConvertibleFromComplexF64>

Tries to convert from a Complex<f64> to the implementor of this trait, either Complex<f64> or f64. The former conversion always succeeds (is a no-op), while the latter fails if number has an imaginary component.

Source

fn to_complexf64(self) -> Complex<f64>

Converts a Complex<f64> or f64 to a Complex<f64>. This is infallible (and a no-op in case of the former conversion).

Source

fn from_f64(value: f64) -> Self

Converts a f64 to a Complex<f64> or f64. This is infallible (and a no-op in case of the latter conversion).

Source

fn set_re_f64(&mut self, value: f64)

Sets the real part of the implementor to value.

Source

fn set_im_f64(&mut self, value: f64)

Sets the imaginary part of the implementor to value. If the implementing type is f64, this is a no-op.

Source

fn nth_root(self, n: i32) -> Self

Calcute the nth root of self.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl F64RealOrComplex for f64

Source§

fn try_from_complexf64( number: Complex<f64>, ) -> Result<Self, NotConvertibleFromComplexF64>

Source§

fn to_complexf64(self) -> Complex<f64>

Source§

fn from_f64(value: f64) -> Self

Source§

fn set_re_f64(&mut self, value: f64)

Source§

fn set_im_f64(&mut self, _: f64)

Source§

fn nth_root(self, n: i32) -> Self

Source§

impl F64RealOrComplex for Complex<f64>

Source§

fn try_from_complexf64( number: Complex<f64>, ) -> Result<Self, NotConvertibleFromComplexF64>

Source§

fn to_complexf64(self) -> Complex<f64>

Source§

fn from_f64(value: f64) -> Self

Source§

fn set_re_f64(&mut self, value: f64)

Source§

fn set_im_f64(&mut self, value: f64)

Source§

fn nth_root(self, n: i32) -> Self

Implementors§