Skip to main content

nominal_api/conjure/objects/timeseries/seriescache/api/
resolution.rs

1/// In nanoseconds.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Deserialize,
6    conjure_object::serde::Serialize,
7    Copy,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash,
13    Default
14)]
15#[serde(crate = "conjure_object::serde", transparent)]
16pub struct Resolution(pub conjure_object::SafeLong);
17impl std::fmt::Display for Resolution {
18    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        std::fmt::Display::fmt(&self.0, fmt)
20    }
21}
22impl conjure_object::Plain for Resolution {
23    fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24        conjure_object::Plain::fmt(&self.0, fmt)
25    }
26}
27impl conjure_object::FromPlain for Resolution {
28    type Err = <conjure_object::SafeLong as conjure_object::FromPlain>::Err;
29    #[inline]
30    fn from_plain(s: &str) -> Result<Resolution, Self::Err> {
31        conjure_object::FromPlain::from_plain(s).map(Resolution)
32    }
33}
34impl std::convert::From<conjure_object::SafeLong> for Resolution {
35    #[inline]
36    fn from(v: conjure_object::SafeLong) -> Self {
37        Resolution(std::convert::From::from(v))
38    }
39}
40impl std::ops::Deref for Resolution {
41    type Target = conjure_object::SafeLong;
42    #[inline]
43    fn deref(&self) -> &conjure_object::SafeLong {
44        &self.0
45    }
46}
47impl std::ops::DerefMut for Resolution {
48    #[inline]
49    fn deref_mut(&mut self) -> &mut conjure_object::SafeLong {
50        &mut self.0
51    }
52}
53impl std::convert::AsRef<conjure_object::SafeLong> for Resolution {
54    #[inline]
55    fn as_ref(&self) -> &conjure_object::SafeLong {
56        &self.0
57    }
58}