Skip to content

Commit

Permalink
rename Sealed FloatFuncsSealed
Browse files Browse the repository at this point in the history
  • Loading branch information
ratmice committed Feb 6, 2024
1 parent 85ad5eb commit cb3c29d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#![allow(missing_docs)]

mod sealed {
pub trait Sealed {}
/// A sealed trait which [sealed trait](https://predr.ag/blog/definitive-guide-to-sealed-traits-in-rust/) which stops this trait
/// from being derived outside the library.
pub trait FloatFuncsSealed {}
}

use arrayvec::ArrayVec;
Expand All @@ -24,15 +26,15 @@ macro_rules! define_float_funcs {
///
/// For documentation see the respective functions in the std library.
#[cfg(not(feature = "std"))]
pub trait FloatFuncs : Sized + sealed::Sealed {
pub trait FloatFuncs : Sized + sealed::FloatFuncsSealed {
/// Special implementation for signum, because libm doesn't have it.
fn signum(self) -> Self;

$(fn $name(self $(,$arg: $arg_ty)*) -> $ret;)+
}

#[cfg(not(feature = "std"))]
impl sealed::Sealed for f32{}
impl sealed::FloatFuncsSealed for f32{}

#[cfg(not(feature = "std"))]
impl FloatFuncs for f32 {
Expand All @@ -55,7 +57,7 @@ macro_rules! define_float_funcs {
}

#[cfg(not(feature = "std"))]
impl sealed::Sealed for f64{}
impl sealed::FloatFuncsSealed for f64{}
#[cfg(not(feature = "std"))]
impl FloatFuncs for f64 {
#[inline]
Expand Down

0 comments on commit cb3c29d

Please sign in to comment.