Skip to main content

twapi_v2/fields/
usage_fields.rs

1use serde::{Deserialize, Serialize};
2use std::collections::HashSet;
3
4#[derive(Serialize, Deserialize, Debug, Eq, Hash, PartialEq, Clone)]
5#[derive(Default)]
6pub enum UsageFields {
7    #[serde(rename = "daily_client_app_usage")]
8    #[default]
9    DailyClientAppUsage,
10    #[serde(rename = "daily_project_usage")]
11    DailyProjectUsage,
12}
13
14impl UsageFields {
15    pub fn all() -> HashSet<Self> {
16        let mut result = HashSet::new();
17        result.insert(Self::DailyClientAppUsage);
18        result.insert(Self::DailyProjectUsage);
19        result
20    }
21}
22
23impl std::fmt::Display for UsageFields {
24    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
25        match self {
26            Self::DailyClientAppUsage => write!(f, "daily_client_app_usage"),
27            Self::DailyProjectUsage => write!(f, "daily_project_usage"),
28        }
29    }
30}
31