#[repr(C)]
pub struct Cartesian<T> { pub re: T, pub im: T, }

Fields

re: T

Real part.

im: T

Imaginary part.

Implementations

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(1f32,2f32);
 
c_num = c_num+2f64;
assert_eq!{ c_num.to_string(), "3+2i" };

The resulting type after applying the + operator.

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Performs the += operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(1f32,2f32);
 
c_num += 2f64;
assert_eq!{ c_num.to_string(), "3+2i" };

Argument of the complex number.

Angle of the complex number.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Complex Conjugate of T.

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(-2f32,-4f32);
 
c_num = c_num.conj();
assert_eq!{ c_num.to_string(), "-2+4i" };

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Complex Conjugate of T.

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(-2f32,4f32);
assert_eq!{ c_num.to_string(), "-2+4i" };
let mut c_num = Cartesian::new(2f32,-4f32);
assert_eq!{ c_num.to_string(), "2-4i" };

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(-2f32,4f32);
 
c_num = c_num/2f64;
assert_eq!{ c_num.to_string(), "-1+2i" };

The resulting type after applying the / operator.

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(-2f32,4f32);
 
c_num /= 2f64;
assert_eq!{ c_num.to_string(), "-1+2i" };

Magnitude of the complex number.

Magnitude of the complex number.

Absolute value.

Type cast from real number T to Complex.

Generic type cast from numeric type T.

Generic type cast to numeric type T.

Return the zero value of type Self.

Return the zero value of type Self.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(1f32,2f32);
 
c_num = c_num*2f64;
assert_eq!{ c_num.to_string(), "2+4i" };

The resulting type after applying the * operator.

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Type cast from real number T to Complex.

Create a complex number from polar coordinates.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(1f32,2f32);
 
c_num = c_num-2f64;
assert_eq!{ c_num.to_string(), "-1+2i" };

The resulting type after applying the - operator.

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Performs the -= operation. Read more

Example
use mixed_num::*;
use mixed_num::traits::*;
 
let mut c_num = Cartesian::new(1f32,2f32);
 
c_num = c_num-2f64;
assert_eq!{ c_num.to_string(), "-1+2i" };

Converison to Complex.

Complex to Polar.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Returns the argument unchanged.

Calls U::from(self).

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

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Should always be Self

Casts the value.

Casts the value.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

Casts the value.

WrappingCasts the value.