Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for duration_new_checked #125748

Closed
3 tasks
jmillikin opened this issue May 30, 2024 · 0 comments
Closed
3 tasks

Tracking Issue for duration_new_checked #125748

jmillikin opened this issue May 30, 2024 · 0 comments
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@jmillikin
Copy link
Contributor

jmillikin commented May 30, 2024

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

@jmillikin jmillikin added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels May 30, 2024
@jmillikin jmillikin closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant