We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39aff7c commit bde7d91Copy full SHA for bde7d91
text/0000-duration-checked-sub.md
@@ -54,7 +54,7 @@ underlying primitive types:
54
55
```rust
56
impl Duration {
57
- fn checked_sub(self, rhs: Duration) -> Duration {
+ fn checked_sub(self, rhs: Duration) -> Option<Duration> {
58
if let Some(mut secs) = self.secs.checked_sub(rhs.secs) {
59
let nanos = if self.nanos >= rhs.nanos {
60
self.nanos - rhs.nanos
@@ -67,7 +67,7 @@ impl Duration {
67
}
68
};
69
debug_assert!(nanos < NANOS_PER_SEC);
70
- Duration { secs: secs, nanos: nanos }
+ Some(Duration { secs: secs, nanos: nanos })
71
72
else {
73
None
0 commit comments