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, Default)]
5pub enum UsageFields {
6    #[serde(rename = "daily_client_app_usage")]
7    #[default]
8    DailyClientAppUsage,
9    #[serde(rename = "daily_project_usage")]
10    DailyProjectUsage,
11}
12
13impl UsageFields {
14    pub fn all() -> HashSet<Self> {
15        let mut result = HashSet::new();
16        result.insert(Self::DailyClientAppUsage);
17        result.insert(Self::DailyProjectUsage);
18        result
19    }
20}
21
22impl std::fmt::Display for UsageFields {
23    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
24        match self {
25            Self::DailyClientAppUsage => write!(f, "daily_client_app_usage"),
26            Self::DailyProjectUsage => write!(f, "daily_project_usage"),
27        }
28    }
29}