@@ -6,20 +6,15 @@ pub trait Measurement {
6
6
#[ macro_export]
7
7
macro_rules! implement_measurement {
8
8
( $( $t: ty) * ) => ( $(
9
- // TODO: Find a better way to reference these...
10
- use std:: ops:: { Add , Sub , Div , Mul } ;
11
- use std:: cmp:: { Eq , PartialEq } ;
12
- use std:: cmp:: { PartialOrd , Ordering } ;
13
-
14
- impl Add for $t {
9
+ impl :: std:: ops:: Add for $t {
15
10
type Output = Self ;
16
11
17
12
fn add( self , rhs: Self ) -> Self {
18
13
Self :: from_base_units( self . get_base_units( ) + rhs. get_base_units( ) )
19
14
}
20
15
}
21
16
22
- impl Sub for $t {
17
+ impl :: std :: ops :: Sub for $t {
23
18
type Output = Self ;
24
19
25
20
fn sub( self , rhs: Self ) -> Self {
@@ -30,7 +25,7 @@ macro_rules! implement_measurement {
30
25
///
31
26
/// Dividing a `$t` by another `$` returns a ratio.
32
27
///
33
- impl Div <$t> for $t {
28
+ impl :: std :: ops :: Div <$t> for $t {
34
29
type Output = f64 ;
35
30
36
31
fn div( self , rhs: Self ) -> f64 {
@@ -41,7 +36,7 @@ macro_rules! implement_measurement {
41
36
///
42
37
/// Dividing a `$` by a factor returns a new portion of the measurement.
43
38
///
44
- impl Div <f64 > for $t {
39
+ impl :: std :: ops :: Div <f64 > for $t {
45
40
type Output = Self ;
46
41
47
42
fn div( self , rhs: f64 ) -> Self {
@@ -52,7 +47,7 @@ macro_rules! implement_measurement {
52
47
///
53
48
/// Multiplying a `$t` by another `$t` returns the product of those measurements.
54
49
///
55
- impl Mul <$t> for $t {
50
+ impl :: std :: ops :: Mul <$t> for $t {
56
51
type Output = Self ;
57
52
58
53
fn mul( self , rhs: Self ) -> Self {
@@ -63,23 +58,23 @@ macro_rules! implement_measurement {
63
58
///
64
59
/// Multiplying a `$t` by a factor increases (or decreases) that measurement a number of times.
65
60
///
66
- impl Mul <f64 > for $t {
61
+ impl :: std :: ops :: Mul <f64 > for $t {
67
62
type Output = Self ;
68
63
69
64
fn mul( self , rhs: f64 ) -> Self {
70
65
Self :: from_base_units( self . get_base_units( ) * rhs)
71
66
}
72
67
}
73
68
74
- impl Eq for $t { }
75
- impl PartialEq for $t {
69
+ impl :: std :: cmp :: Eq for $t { }
70
+ impl :: std :: cmp :: PartialEq for $t {
76
71
fn eq( & self , other: & Self ) -> bool {
77
72
self . get_base_units( ) == other. get_base_units( )
78
73
}
79
74
}
80
75
81
- impl PartialOrd for $t {
82
- fn partial_cmp( & self , other: & Self ) -> Option <Ordering > {
76
+ impl :: std :: cmp :: PartialOrd for $t {
77
+ fn partial_cmp( & self , other: & Self ) -> Option <:: std :: cmp :: Ordering > {
83
78
self . get_base_units( ) . partial_cmp( & other. get_base_units( ) )
84
79
}
85
80
}
0 commit comments