mixed_num/traits/
complex_traits.rs1use crate::*;
5
6pub trait ToCartesian<T> {
7 fn to_cartesian( &self ) -> Cartesian<T>;
8}
9
10pub trait ToPolar<T> {
11 fn to_polar( &self ) -> Polar<T>;
12}
13
14pub trait MixedComplexConversion<T> {
15 fn mixed_to_complex( number:T ) -> Self;
17}
18
19pub trait NewFromCartesian<T>
20 where Self: MixedComplex
21{
22 fn new_from_cartesian( re:T, im:T ) -> Self;
24}
25
26pub trait NewFromPolar<T>
27 where Self: MixedComplex
28{
29 fn new_from_polar( mag:T, ang:T ) -> Self;
31}
32
33pub trait Mag<T>
34 where Self: MixedComplex
35{
36 fn mag( &self ) -> T;
38 fn abs( &self ) -> T;
40}
41
42pub trait Arg<T>
43 where Self: MixedComplex
44{
45 fn arg( &self ) -> T;
47
48 fn ang( &self ) -> T;
50}
51
52pub trait Conj<T>
53 where Self: MixedComplex
54{
55 fn conj( &self ) -> T;
57}