scsys_time/traits/
raw_timestamp.rs1pub trait RawTimestamp {
8 private!();
9}
10pub trait TimestampRepr {
13 type Value;
14
15 private! {}
16}
17
18use crate::timestamp::Timestamp;
22
23impl<T> TimestampRepr for Timestamp<T>
24where
25 T: RawTimestamp,
26{
27 type Value = T;
28
29 seal!();
30}
31
32impl<T> RawTimestamp for &T
33where
34 T: RawTimestamp + ?Sized,
35{
36 seal!();
37}
38
39impl<T> RawTimestamp for &mut T
40where
41 T: RawTimestamp + ?Sized,
42{
43 seal!();
44}
45
46macro_rules! impl_raw_timestamp {
47 ($($t:ty),* $(,)?) => {
48 $(
49 impl_raw_timestamp!(@impl $t);
50 )*
51 };
52 (@impl $T:ty) => {
53 impl RawTimestamp for $T {
54 seal!();
55 }
56 };
57}
58
59impl_raw_timestamp! {
60 u64,
61 u128,
62 i64,
63}
64
65impl RawTimestamp for str {
66 seal!();
67}
68
69#[cfg(feature = "alloc")]
70mod impl_alloc {
71 use super::RawTimestamp;
72 use alloc::string::String;
73
74 impl RawTimestamp for String {
75 seal!();
76 }
77}
78
79#[cfg(feature = "chrono")]
80mod impl_chrono {
81 use super::RawTimestamp;
82 use chrono::DateTime;
83 use chrono::offset::TimeZone;
84
85 impl<Tz> RawTimestamp for DateTime<Tz>
86 where
87 Tz: TimeZone,
88 {
89 seal!();
90 }
91}