ComplexScalarSetParts

Trait ComplexScalarSetParts 

Source
pub trait ComplexScalarSetParts: ComplexScalarGetParts {
    // Required methods
    fn set_real_part(&mut self, real_part: Self::RealType);
    fn set_imaginary_part(&mut self, imag_part: Self::RealType);

    // Provided methods
    fn with_real_part(self, real_part: Self::RealType) -> Self { ... }
    fn with_imaginary_part(self, imag_part: Self::RealType) -> Self { ... }
}
Expand description

Trait for setting the real and imaginary components of a complex scalar.

Required Methods§

Source

fn set_real_part(&mut self, real_part: Self::RealType)

Set the real part of the complex number.

Source

fn set_imaginary_part(&mut self, imag_part: Self::RealType)

Set the imaginary part of the complex number.

Provided Methods§

Source

fn with_real_part(self, real_part: Self::RealType) -> Self

Returns a new complex number with the real part set to the given value and the imaginary part from self.

Source

fn with_imaginary_part(self, imag_part: Self::RealType) -> Self

Returns a new complex number with the imaginary part set to the given value and the real part from 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 ComplexScalarSetParts for Complex<f64>

Implement the ComplexScalarSetParts trait for the Complex<f64> type.

Source§

fn set_real_part(&mut self, real_part: f64)

Set the value of the real part.

§Panics

In debug builds, this will panic if real_part is not finite. This check is disabled in release builds for performance.

Source§

fn set_imaginary_part(&mut self, imag_part: f64)

Set the value of the imaginary part.

§Panics

In debug builds, this will panic if imag_part is not finite. This check is disabled in release builds for performance.

Implementors§