- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
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 RFCT-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
Feature gate: #![feature(duration_checked_float)]
This is a tracking issue for checked methods to construct a duration from a floating-point value of seconds without panicking.
Public API
// core::time
impl Duration {
    pub const fn try_from_secs_f32(secs: f32) -> Result<Duration, FromFloatSecsError>;
    pub const fn try_from_secs_f64(secs: f64) -> Result<Duration, FromFloatSecsError>;
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct FromFloatSecsError { ... }
impl core::fmt::Display for FromFloatSecsError { ... }// std::error
impl std::error::Error for FromFloatSecsError { ... }Steps / History
- Implementation
- Final commenting period (FCP)
- Stabilization PR
Unresolved Questions
- What should the error type be called?
- Originally FromSecsError.
- Changed to FromFloatSecsErrorin Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa #90247
- Changed and finalised as TryFromFloatSecsErrorin Stabilizeduration_checked_float#102271
 
- Originally 
Metadata
Metadata
Assignees
Labels
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 RFCT-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.