num_traits/ops/
inv.rs
1pub trait Inv {
3 type Output;
5
6 fn inv(self) -> Self::Output;
18}
19
20impl Inv for f32 {
21 type Output = f32;
22 #[inline]
23 fn inv(self) -> f32 {
24 1.0 / self
25 }
26}
27impl Inv for f64 {
28 type Output = f64;
29 #[inline]
30 fn inv(self) -> f64 {
31 1.0 / self
32 }
33}
34impl<'a> Inv for &'a f32 {
35 type Output = f32;
36 #[inline]
37 fn inv(self) -> f32 {
38 1.0 / *self
39 }
40}
41impl<'a> Inv for &'a f64 {
42 type Output = f64;
43 #[inline]
44 fn inv(self) -> f64 {
45 1.0 / *self
46 }
47}