pub struct Rectangular { /* private fields */ }
Implementations§
Source§impl Rectangular
impl Rectangular
Sourcepub fn new(real: f64, imag: f64) -> Self
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}
Sourcepub fn get_polar(&self) -> Polar
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}
pub fn real(&self) -> f64
pub fn imag(&self) -> f64
Trait Implementations§
Source§impl Add<f64> for Rectangular
impl Add<f64> for Rectangular
Source§impl Add for Rectangular
impl Add for Rectangular
Source§impl Debug for Rectangular
impl Debug for Rectangular
Source§impl Display for Rectangular
impl Display for Rectangular
Source§impl Div<f64> for Rectangular
impl Div<f64> for Rectangular
Source§impl Div for Rectangular
impl Div for Rectangular
Source§impl Mul<f64> for Rectangular
impl Mul<f64> for Rectangular
Source§impl Mul for Rectangular
impl Mul for Rectangular
Source§impl Sub<f64> for Rectangular
impl Sub<f64> for Rectangular
Auto Trait Implementations§
impl Freeze for Rectangular
impl RefUnwindSafe for Rectangular
impl Send for Rectangular
impl Sync for Rectangular
impl Unpin for Rectangular
impl UnwindSafe for Rectangular
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more