twapi_v2/fields/
trend_fields.rs

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