Skip to main content

Complex

Struct Complex 

Source
#[repr(C)]
pub struct Complex<T> { pub re: T, pub im: T, }
๐Ÿ”ฌThis is a nightly-only experimental API. (complex_numbers #154023)
Expand description

A complex number.

Fieldsยง

ยงre: T
๐Ÿ”ฌThis is a nightly-only experimental API. (complex_numbers #154023)

The real component.

ยงim: T
๐Ÿ”ฌThis is a nightly-only experimental API. (complex_numbers #154023)

The imaginary component.

Implementationsยง

Sourceยง

impl<T> Complex<T>

Source

pub const fn new(re: T, im: T) -> Complex<T>

๐Ÿ”ฌThis is a nightly-only experimental API. (complex_numbers #154023)

Create a new complex number from a real and imaginary component.

Sourceยง

impl<T> Complex<T>
where T: Neg<Output = T>,

Source

pub fn conjugate(self) -> Complex<T>

๐Ÿ”ฌThis is a nightly-only experimental API. (complex_numbers #154023)

The complex conjugate of a complex number.

The conjugate of a + bi is a - bi: the imaginary component is negated. Geometrically, this is a reflection across the real axis.

Trait Implementationsยง

Sourceยง

impl<T> Add for Complex<T>
where T: Add,

Sourceยง

type Output = Complex<<T as Add>::Output>

The resulting type after applying the + operator.
Sourceยง

fn add(self, rhs: Complex<T>) -> <Complex<T> as Add>::Output

Performs the + operation. Read more
Sourceยง

impl<T> Add<T> for Complex<T>
where T: Add<Output = T>,

Sourceยง

type Output = Complex<<T as Add>::Output>

The resulting type after applying the + operator.
Sourceยง

fn add(self, rhs: T) -> <Complex<T> as Add<T>>::Output

Performs the + operation. Read more
Sourceยง

impl<T> Clone for Complex<T>
where T: Clone,

Sourceยง

fn clone(&self) -> Complex<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl<T> Copy for Complex<T>
where T: Copy,

Sourceยง

impl<T> Debug for Complex<T>
where T: Debug,

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Sourceยง

impl<T> Default for Complex<T>
where T: Default,

Sourceยง

fn default() -> Complex<T>

Returns the โ€œdefault valueโ€ for a type. Read more
Sourceยง

impl<T> Eq for Complex<T>
where T: Eq,

Sourceยง

impl<T> Neg for Complex<T>
where T: Neg,

Sourceยง

fn neg(self) -> <Complex<T> as Neg>::Output

Negate a complex number.

The negation of a + bi is -a - bi: both components are negated. Geometrically this is a rotation of 180ยฐ.

Sourceยง

type Output = Complex<<T as Neg>::Output>

The resulting type after applying the - operator.
Sourceยง

impl<T> PartialEq for Complex<T>
where T: PartialEq,

Sourceยง

fn eq(&self, other: &Complex<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) ยท Sourceยง

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Sourceยง

impl<T> StructuralPartialEq for Complex<T>
where T: PartialEq,

Sourceยง

impl<T> Sub for Complex<T>
where T: Sub,

Sourceยง

type Output = Complex<<T as Sub>::Output>

The resulting type after applying the - operator.
Sourceยง

fn sub(self, rhs: Complex<T>) -> <Complex<T> as Sub>::Output

Performs the - operation. Read more
Sourceยง

impl<T> Sub<T> for Complex<T>
where T: Sub<Output = T>,

Sourceยง

type Output = Complex<<T as Sub>::Output>

The resulting type after applying the - operator.
Sourceยง

fn sub(self, rhs: T) -> <Complex<T> as Sub<T>>::Output

Performs the - operation. Read more

Auto Trait Implementationsยง

ยง

impl<T> Freeze for Complex<T>
where T: Freeze,

ยง

impl<T> RefUnwindSafe for Complex<T>
where T: RefUnwindSafe,

ยง

impl<T> Send for Complex<T>
where T: Send,

ยง

impl<T> Sync for Complex<T>
where T: Sync,

ยง

impl<T> Unpin for Complex<T>
where T: Unpin,

ยง

impl<T> UnsafeUnpin for Complex<T>
where T: UnsafeUnpin,

ยง

impl<T> UnwindSafe for Complex<T>
where T: UnwindSafe,

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = !

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.