File tree Expand file tree Collapse file tree 4 files changed +15
-0
lines changed Expand file tree Collapse file tree 4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -92,13 +92,15 @@ impl Add<Duration> for Instant {
92
92
///
93
93
/// This function may panic if the resulting point in time cannot be represented by the
94
94
/// underlying data structure. See [`Instant::checked_add`] for a version without panic.
95
+ #[ inline]
95
96
fn add ( self , other : Duration ) -> Self {
96
97
self . checked_add ( other)
97
98
. expect ( "overflow when adding duration to instant" )
98
99
}
99
100
}
100
101
101
102
impl AddAssign < Duration > for Instant {
103
+ #[ inline]
102
104
fn add_assign ( & mut self , other : Duration ) {
103
105
* self = * self + other;
104
106
}
@@ -107,13 +109,15 @@ impl AddAssign<Duration> for Instant {
107
109
impl Sub < Duration > for Instant {
108
110
type Output = Self ;
109
111
112
+ #[ inline]
110
113
fn sub ( self , other : Duration ) -> Self {
111
114
self . checked_sub ( other)
112
115
. expect ( "overflow when subtracting duration from instant" )
113
116
}
114
117
}
115
118
116
119
impl SubAssign < Duration > for Instant {
120
+ #[ inline]
117
121
fn sub_assign ( & mut self , other : Duration ) {
118
122
* self = * self - other;
119
123
}
@@ -122,6 +126,7 @@ impl SubAssign<Duration> for Instant {
122
126
impl Sub < Instant > for Instant {
123
127
type Output = Duration ;
124
128
129
+ #[ inline]
125
130
fn sub ( self , other : Self ) -> Duration {
126
131
self . duration_since ( other)
127
132
}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ impl MonotonicClock {
15
15
/// # Safety
16
16
///
17
17
/// This is unsafe because access to clocks is an ambient authority.
18
+ #[ inline]
18
19
pub unsafe fn new ( ) -> Self {
19
20
Self ( ( ) )
20
21
}
@@ -24,6 +25,7 @@ impl MonotonicClock {
24
25
/// This corresponds to [`Instant::now`].
25
26
///
26
27
/// [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now
28
+ #[ inline]
27
29
pub fn now ( & self ) -> Instant {
28
30
Instant :: from_std ( time:: Instant :: now ( ) )
29
31
}
@@ -33,6 +35,7 @@ impl MonotonicClock {
33
35
/// This corresponds to [`Instant::elapsed`].
34
36
///
35
37
/// [`Instant::elapsed`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.elapsed
38
+ #[ inline]
36
39
pub fn elapsed ( & self , instant : Instant ) -> Duration {
37
40
instant. std . elapsed ( )
38
41
}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ impl SystemClock {
26
26
/// # Safety
27
27
///
28
28
/// This is unsafe because access to clocks is an ambient authority.
29
+ #[ inline]
29
30
pub unsafe fn new ( ) -> Self {
30
31
Self ( ( ) )
31
32
}
@@ -35,6 +36,7 @@ impl SystemClock {
35
36
/// This corresponds to [`SystemTime::now`].
36
37
///
37
38
/// [`SystemTime::now`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.now
39
+ #[ inline]
38
40
pub fn now ( & self ) -> SystemTime {
39
41
SystemTime :: from_std ( time:: SystemTime :: now ( ) )
40
42
}
@@ -44,6 +46,7 @@ impl SystemClock {
44
46
/// This corresponds to [`SystemTime::elapsed`].
45
47
///
46
48
/// [`SystemTime::elapsed`]: https://doc.rust-lang.org/std/time/struct.SystemTime.html#method.elapsed
49
+ #[ inline]
47
50
pub fn elapsed ( & self , system_time : SystemTime ) -> Result < Duration , SystemTimeError > {
48
51
system_time. std . elapsed ( )
49
52
}
Original file line number Diff line number Diff line change @@ -98,13 +98,15 @@ impl Add<Duration> for SystemTime {
98
98
///
99
99
/// This function may panic if the resulting point in time cannot be represented by the
100
100
/// underlying data structure. See [`SystemTime::checked_add`] for a version without panic.
101
+ #[ inline]
101
102
fn add ( self , dur : Duration ) -> Self {
102
103
self . checked_add ( dur)
103
104
. expect ( "overflow when adding duration to instant" )
104
105
}
105
106
}
106
107
107
108
impl AddAssign < Duration > for SystemTime {
109
+ #[ inline]
108
110
fn add_assign ( & mut self , other : Duration ) {
109
111
* self = * self + other;
110
112
}
@@ -113,13 +115,15 @@ impl AddAssign<Duration> for SystemTime {
113
115
impl Sub < Duration > for SystemTime {
114
116
type Output = Self ;
115
117
118
+ #[ inline]
116
119
fn sub ( self , dur : Duration ) -> Self {
117
120
self . checked_sub ( dur)
118
121
. expect ( "overflow when subtracting duration from instant" )
119
122
}
120
123
}
121
124
122
125
impl SubAssign < Duration > for SystemTime {
126
+ #[ inline]
123
127
fn sub_assign ( & mut self , other : Duration ) {
124
128
* self = * self - other;
125
129
}
You can’t perform that action at this time.
0 commit comments