about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-06-20 14:44:53 -0700
committerGitHub <noreply@github.com>2020-06-20 14:44:53 -0700
commitc47550f9e405d5817e69eb8d42995c63b60bbd8b (patch)
treed6ca1b1f99caa07e096b651ef2e464106b97cccb /library/std/src/sys/unix/stack_overflow.rs
parent1a171d0d5b4b76170da94858869e42ebb6e2ced2 (diff)
parent386114bfd3c8240154a00b00296da9f105bd97ce (diff)
downloadrust-c47550f9e405d5817e69eb8d42995c63b60bbd8b.tar.gz
rust-c47550f9e405d5817e69eb8d42995c63b60bbd8b.zip
Rollup merge of #72790 - jonhoo:duration-is-zero, r=LukasKalbertodt
core/time: Add Duration methods for zero

This patch adds two methods to `Duration`. The first, `Duration::zero`,
provides a `const` constructor for getting an zero-length duration. This
is also what `Default` provides (this was clarified in the docs), though
`default` is not `const`.

The second, `Duration::is_zero`, returns true if a `Duration` spans no
time (i.e., because its components are all zero). Previously, the way to
do this was either to compare both `as_secs` and `subsec_nanos` to 0, to
compare against `Duration::new(0, 0)`, or to use the `u128` method
`as_nanos`, none of which were particularly elegant.
Diffstat (limited to 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions