concision_utils/traits/
precision.rs1pub trait FloorDiv<Rhs = Self> {
2 type Output;
3
4 fn floor_div(self, rhs: Rhs) -> Self::Output;
5}
6
7pub trait RoundTo {
8 fn round_to(&self, places: usize) -> Self;
9}
10
11impl<T> FloorDiv for T
12where
13 T: Copy + num_traits::Num,
14{
15 type Output = T;
16
17 fn floor_div(self, rhs: Self) -> Self::Output {
18 crate::floor_div(self, rhs)
19 }
20}
21
22impl<T> RoundTo for T
23where
24 T: num_traits::Float,
25{
26 fn round_to(&self, places: usize) -> Self {
27 crate::round_to(*self, places)
28 }
29}