about summary refs log tree commit diff
path: root/src/test/debuginfo/enum-thinlto.rs
diff options
context:
space:
mode:
authorJon Gjengset <jon@thesquareplanet.com>2020-05-30 14:55:38 -0400
committerJon Gjengset <jon@thesquareplanet.com>2020-06-20 10:53:39 -0400
commit3ff5879f8d50da4807c639a17df5884bcaa8b319 (patch)
tree0ebd8636f594bf7e6ff882a2df3a08efde1d008b /src/test/debuginfo/enum-thinlto.rs
parent033013cab3a861224fd55f494c8be1cb0349eb49 (diff)
downloadrust-3ff5879f8d50da4807c639a17df5884bcaa8b319.tar.gz
rust-3ff5879f8d50da4807c639a17df5884bcaa8b319.zip
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 'src/test/debuginfo/enum-thinlto.rs')
0 files changed, 0 insertions, 0 deletions