Skip to main content

flowsurface_data/
aggr.rs

1pub mod ticks;
2pub mod time;
3
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7pub struct TickCount(pub u16);
8
9impl TickCount {
10    pub const ALL: [TickCount; 7] = [
11        TickCount(10),
12        TickCount(20),
13        TickCount(50),
14        TickCount(100),
15        TickCount(200),
16        TickCount(500),
17        TickCount(1000),
18    ];
19
20    pub fn is_custom(&self) -> bool {
21        !Self::ALL.contains(self)
22    }
23}
24
25impl std::fmt::Display for TickCount {
26    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
27        write!(f, "{}T", self.0)
28    }
29}