Remove const impl

This commit is contained in:
Max Känner 2023-04-23 18:37:17 +02:00
parent 67daf8d73f
commit 4c73f860d3
2 changed files with 2 additions and 34 deletions

View File

@ -25,5 +25,4 @@ default = ["std"]
defmt = ["dep:defmt"] defmt = ["dep:defmt"]
fixed = ["dep:fixed"] fixed = ["dep:fixed"]
std = ["num-traits/std"] std = ["num-traits/std"]
nightly = []
serde = ["dep:serde"] serde = ["dep:serde"]

View File

@ -1,6 +1,4 @@
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(const_trait_impl))]
#![cfg_attr(feature = "nightly", feature(trait_alias))]
mod display; mod display;
pub mod types; pub mod types;
@ -42,9 +40,6 @@ where
_cd: PhantomData<Candela>, _cd: PhantomData<Candela>,
} }
#[cfg(not(feature = "nightly"))]
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Deref
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where where
Second: Integer, Second: Integer,
Metre: Integer, Metre: Integer,
@ -54,14 +49,9 @@ where
Mole: Integer, Mole: Integer,
Candela: Integer, Candela: Integer,
{ {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.value
}
} }
#[cfg(feature = "nightly")]
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> const Deref impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Deref
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where where
Second: Integer, Second: Integer,
@ -95,7 +85,6 @@ where
} }
} }
#[cfg(not(feature = "nightly"))]
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Neg impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Neg
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where where
@ -114,26 +103,6 @@ where
Self::Output::new(-self.value) Self::Output::new(-self.value)
} }
} }
#[cfg(feature = "nightly")]
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> const Neg
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>
where
Second: Integer,
Metre: Integer,
Kilogram: Integer,
Ampere: Integer,
Kelvin: Integer,
Mole: Integer,
Candela: Integer,
T: ~const Neg,
Self: ~const Destruct,
{
type Output = SiUnit<T::Output, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>;
fn neg(self) -> Self::Output {
Self::Output::new(-self.value)
}
}
impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Zero impl<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> Zero
for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela> for SiUnit<T, Second, Metre, Kilogram, Ampere, Kelvin, Mole, Candela>