inc_stats/
copy.rs

1//! Trait for copying for ownership
2//!
3//! This ultimately allows methods to take either references or owned values and still do type
4//! inference
5
6pub trait DerefCopy: Copy {
7    type Output;
8    fn deref_copy(self) -> Self::Output;
9}
10
11impl<T: Copy> DerefCopy for &T {
12    type Output = T;
13    fn deref_copy(self) -> T {
14        *self
15    }
16}
17
18impl DerefCopy for f64 {
19    type Output = Self;
20    fn deref_copy(self) -> Self {
21        self
22    }
23}
24
25impl DerefCopy for f32 {
26    type Output = Self;
27    fn deref_copy(self) -> Self {
28        self
29    }
30}