mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-28 12:50:37 +00:00
Take self instead of &mut self
This is more idiomatic since methods with these names usually take self and not &mut self.
This commit is contained in:
parent
b7fbf6d519
commit
865266a4ae
@ -117,13 +117,15 @@ impl Instant {
|
||||
}
|
||||
|
||||
/// Adds a Duration to self. In case of overflow, the maximum value is returned.
|
||||
pub fn saturating_add(&mut self, duration: Duration) {
|
||||
pub fn saturating_add(mut self, duration: Duration) -> Self {
|
||||
self.ticks = self.ticks.saturating_add(duration.ticks);
|
||||
self
|
||||
}
|
||||
|
||||
/// Subtracts a Duration from self. In case of overflow, the minimum value is returned.
|
||||
pub fn saturating_sub(&mut self, duration: Duration) {
|
||||
pub fn saturating_sub(mut self, duration: Duration) -> Self {
|
||||
self.ticks = self.ticks.saturating_sub(duration.ticks);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user