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; 10] = [
11        TickCount(10),
12        TickCount(20),
13        TickCount(50),
14        TickCount(100),
15        TickCount(200),
16        TickCount(500),
17        TickCount(1000),
18        TickCount(2000),
19        TickCount(5000),
20        TickCount(10000),
21    ];
22
23    pub fn is_custom(&self) -> bool {
24        !Self::ALL.contains(self)
25    }
26}
27
28impl std::fmt::Display for TickCount {
29    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
30        write!(f, "{}T", self.0)
31    }
32}