Open
Description
Implemented in #57375
This will make working with durations more ergonomic. Compare:
// Convenient, but deprecated function. thread::sleep_ms(2000); // The current canonical way to sleep for two seconds. thread::sleep(Duration::from_secs(2)); // Sleeping using one of the new constants. thread::sleep(2 * SECOND);
impl Duration {
pub const SECOND: Duration = Duration::from_secs(1);
pub const MILLISECOND: Duration = Duration::from_millis(1);
pub const MICROSECOND: Duration = Duration::from_micros(1);
pub const NANOSECOND: Duration = Duration::from_nanos(1);
pub const MAX: Duration = ...;
}