scsys_time/timestamp/
impl_timestamp_repr.rs

1/*
2    appellation: impl_timestamp_repr <module>
3    authors: @FL03
4*/
5use super::Timestamp;
6
7use crate::traits::RawTimestamp;
8
9impl<T> Timestamp<&T>
10where
11    T: RawTimestamp,
12{
13    /// returns a new [`Timestamp`] containing a clone of the current value
14    pub fn cloned(&self) -> Timestamp<T>
15    where
16        T: Clone,
17    {
18        Timestamp(self.0.clone())
19    }
20    /// returns a new [`Timestamp`] containing a copy of the current value
21    pub fn copied(&self) -> Timestamp<T>
22    where
23        T: Copy,
24    {
25        Timestamp(*self.0)
26    }
27}
28
29impl<T> Timestamp<&mut T>
30where
31    T: RawTimestamp,
32{
33    /// returns a new [`Timestamp`] containing a clone of the current value
34    pub fn cloned(&self) -> Timestamp<T>
35    where
36        T: Clone,
37    {
38        Timestamp(self.0.clone())
39    }
40    /// returns a new [`Timestamp`] containing a copy of the current value
41    pub fn copied(&self) -> Timestamp<T>
42    where
43        T: Copy,
44    {
45        Timestamp(*self.0)
46    }
47}