pub struct Imaginary<T>(pub T);Expand description
A standalone imaginary value.
Tuple Fields§
§0: TImplementations§
Source§impl<T> Imaginary<T>
impl<T> Imaginary<T>
Sourcepub const fn new(value: T) -> Self
pub const fn new(value: T) -> Self
Creates a new imaginary value.
Examples found in repository?
examples/basic_usage.rs (line 6)
3fn main() {
4 let value = Complex::new(3.0_f64, 4.0_f64);
5 let mirrored = value.conjugate();
6 let lifted = Complex::from(Imaginary::new(4.0_f64));
7 let (magnitude, argument) = value.to_polar();
8
9 assert_eq!(value + Complex::one(), Complex::new(4.0, 4.0));
10 assert_eq!(mirrored, Complex::new(3.0, -4.0));
11 assert_eq!(lifted, Complex::new(0.0, 4.0));
12 assert!((magnitude - 5.0).abs() <= 1.0e-10);
13 assert!((argument - value.argument()).abs() <= 1.0e-10);
14}Trait Implementations§
Source§impl<T: PartialEq> PartialEq for Imaginary<T>
impl<T: PartialEq> PartialEq for Imaginary<T>
impl<T: Copy> Copy for Imaginary<T>
impl<T: Eq> Eq for Imaginary<T>
impl<T> StructuralPartialEq for Imaginary<T>
Auto Trait Implementations§
impl<T> Freeze for Imaginary<T>where
T: Freeze,
impl<T> RefUnwindSafe for Imaginary<T>where
T: RefUnwindSafe,
impl<T> Send for Imaginary<T>where
T: Send,
impl<T> Sync for Imaginary<T>where
T: Sync,
impl<T> Unpin for Imaginary<T>where
T: Unpin,
impl<T> UnsafeUnpin for Imaginary<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Imaginary<T>where
T: UnwindSafe,
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