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)
Expand description

A complex number.

Fieldsยง

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

The real component.

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

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)

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)

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 Div for Complex<f16>

Sourceยง

type Output = Complex<f16>

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

fn div(self, rhs: Complex<f16>) -> <Complex<f16> as Div>::Output

Performs the / operation. Read more
Sourceยง

impl Div for Complex<f32>

Sourceยง

type Output = Complex<f32>

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

fn div(self, rhs: Complex<f32>) -> <Complex<f32> as Div>::Output

Performs the / operation. Read more
Sourceยง

impl Div for Complex<f64>

Sourceยง

type Output = Complex<f64>

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

fn div(self, rhs: Complex<f64>) -> <Complex<f64> as Div>::Output

Performs the / operation. Read more
Sourceยง

impl Div for Complex<f128>

Sourceยง

type Output = Complex<f128>

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

fn div(self, rhs: Complex<f128>) -> <Complex<f128> as Div>::Output

Performs the / operation. Read more
Sourceยง

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

Sourceยง

impl Mul for Complex<f16>

Sourceยง

type Output = Complex<f16>

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

fn mul(self, rhs: Complex<f16>) -> <Complex<f16> as Mul>::Output

Performs the * operation. Read more
Sourceยง

impl Mul for Complex<f32>

Sourceยง

type Output = Complex<f32>

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

fn mul(self, rhs: Complex<f32>) -> <Complex<f32> as Mul>::Output

Performs the * operation. Read more
Sourceยง

impl Mul for Complex<f64>

Sourceยง

type Output = Complex<f64>

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

fn mul(self, rhs: Complex<f64>) -> <Complex<f64> as Mul>::Output

Performs the * operation. Read more
Sourceยง

impl Mul for Complex<f128>

Sourceยง

type Output = Complex<f128>

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

fn mul(self, rhs: Complex<f128>) -> <Complex<f128> as Mul>::Output

Performs the * operation. Read more
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Sourceยง

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Sourceยง

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Sourceยง

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Sourceยง

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

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

Sourceยง

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self> โ“˜

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self> โ“˜

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self> โ“˜

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ“˜
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

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

Sourceยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Sourceยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Sourceยง

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

Sourceยง

fn C(&self) -> T

Sourceยง

impl<T> PowerToOwned for T
where T: ToOwned + ?Sized,

Sourceยง

type Owned = <T as ToOwned>::Owned

Sourceยง

fn O(&self) -> <T as PowerToOwned>::Owned

Sourceยง

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Sourceยง

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Sourceยง

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Sourceยง

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Sourceยง

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
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.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> โ“˜
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self> โ“˜

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more