Skip to content

Tracking Issue for duration_new_checked #125748

@jmillikin

Description

@jmillikin

Feature gate: #![feature(duration_new_checked)]

This is a tracking issue for Duration::new_checked() and Duration::new_unchecked(), which provide panic-free constructors for core::time::Duration.

ACP: rust-lang/libs-team#117

Public API

impl core::time::Duration {
    // Returns `None` in cases where `Duration::new()` would panic
    pub const fn new_checked(secs: u64, nanos: u32) -> Option<Duration>;

    // Does not check for nanosecond overflow, enabling free conversion of known-good values.
    pub const unsafe fn new_unchecked(secs: u64, subsec_nanos: u32) -> Duration;
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions