-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticB-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.S-tracking-perma-unstableStatus: The feature will stay unstable indefinitely.Status: The feature will stay unstable indefinitely.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
PR #66841 adds this supporting trait for the {f32,f64}::approx_unchecked_to
method (tracking issue: #67058) to the core::convert
and std::convert
modules:
mod private {
pub trait Sealed {}
}
pub trait FloatToInt<Int>: private::Sealed + Sized {
#[doc(hidden)]
unsafe fn approx_unchecked(self) -> Int;
}
// Macro-generated for all combinations of primitive integer
// and primitive floating point types:
impl FloatToInt<$Int> for $Float {…}
The name and location (and usage of the sealed-trait pattern) are chosen to allow later adding additional methods with different conversion semantics between those types, as proposed in https://internals.rust-lang.org/t/pre-rfc-add-explicitly-named-numeric-conversion-apis/11395
stanislav-tkach, sameer, deg4uss3r, gdesmott, extrawurst and 8 more
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticB-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.S-tracking-perma-unstableStatus: The feature will stay unstable indefinitely.Status: The feature will stay unstable indefinitely.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.