Struct Rectangular

Source
pub struct Rectangular { /* private fields */ }

Implementations§

Source§

impl Rectangular

Source

pub fn new(real: f64, imag: f64) -> Self

Examples found in repository?
examples/basic_rect.rs (line 3)
2fn main() {
3let numb1 = Rectangular::new(1., 2.);
4let numb2 = Rectangular::new(3., 4.);
5
6// numbers in either polar or rectangular form can be added, subtracted, multiplied
7// and divided, just like you would any other number
8let res = (numb1 + numb2).get_polar();
9
10// numbers can also converted between rectangular and polar forms using the get_polar() 
11// and get_rectangular() methods
12
13println!("{res}");   
14}
Source

pub fn get_polar(&self) -> Polar

Examples found in repository?
examples/basic_rect.rs (line 8)
2fn main() {
3let numb1 = Rectangular::new(1., 2.);
4let numb2 = Rectangular::new(3., 4.);
5
6// numbers in either polar or rectangular form can be added, subtracted, multiplied
7// and divided, just like you would any other number
8let res = (numb1 + numb2).get_polar();
9
10// numbers can also converted between rectangular and polar forms using the get_polar() 
11// and get_rectangular() methods
12
13println!("{res}");   
14}
Source

pub fn real(&self) -> f64

Source

pub fn imag(&self) -> f64

Trait Implementations§

Source§

impl Add<f64> for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the + operator.
Source§

fn add(self, rhs: f64) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Complex for Rectangular

Source§

fn conjugate(&self) -> Self

Source§

impl Debug for Rectangular

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for Rectangular

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Div<f64> for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl Mul<f64> for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl Sub<f64> for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: f64) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Rectangular

Source§

type Output = Rectangular

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.