twapi_v2/fields/
usage_fields.rs

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