Skip to content

Add Duration::new_{checked,unchecked} constructors #125749

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

Closed
wants to merge 1 commit into from

Conversation

jmillikin
Copy link
Contributor

@jmillikin jmillikin commented May 30, 2024

Duration::new_checked() returns None in cases where Duration::new() would panic.

Duration::new_unchecked() requires that the provided nanosecond count be less than 1 billion (the number of nanoseconds in a second).

Tracking issue: #125748

`Duration::new_checked()` returns `None` in cases where `Duration::new()`
would panic.

`Duration::new_unchecked()` requires that the provided nanosecond
count be less than 1 billion (the number of nanoseconds in a second).
@rustbot
Copy link
Collaborator

rustbot commented May 30, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels May 30, 2024
@jmillikin jmillikin force-pushed the duration-new-checked branch from 9eae151 to d1839c2 Compare May 30, 2024 00:57
@rust-log-analyzer

This comment has been minimized.

@jmillikin jmillikin force-pushed the duration-new-checked branch 2 times, most recently from e1a52e4 to fd0e24d Compare May 30, 2024 01:03
@rust-log-analyzer

This comment has been minimized.

@jhpratt
Copy link
Member

jhpratt commented May 30, 2024

Per rust-lang/libs-team#117 (comment), only Duration::new_checked was approved. The implementation of this looks good; I will approve if Duration::new_unchecked is removed.

@jhpratt jhpratt assigned jhpratt and unassigned Mark-Simulacrum May 30, 2024
@jmillikin
Copy link
Contributor Author

I have no need for new_checked() myself, and only added it because there was some interest from the reviewer.

I'll keep this PR open until @the8472 can weigh in on the assembly listings in the ACP. If there's truly no interest from the Rust devs regarding new_unchecked then I'll close it.

@jmillikin jmillikin force-pushed the duration-new-checked branch from a810b77 to 1f05027 Compare May 30, 2024 13:38
@rust-log-analyzer

This comment has been minimized.

@jmillikin jmillikin force-pushed the duration-new-checked branch from 1f05027 to 7964ef4 Compare May 30, 2024 13:42
@jmillikin jmillikin closed this Jun 9, 2024
@jmillikin jmillikin deleted the duration-new-checked branch June 9, 2024 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants