-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-timeArea: TimeArea: TimeB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
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 = ...;
}
stanislav-tkach, YerinAlexey, sollyucko, hirrolot, jRimbault and 32 morearniuyoshuawuyts, mark-i-m, Varimatrass, cjbassi, faern and 11 more
Metadata
Metadata
Assignees
Labels
A-timeArea: TimeArea: TimeB-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.