Skip to main content

twapi_v2/fields/
trend_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 TrendFields {
7    #[serde(rename = "trend_name")]
8    #[default]
9    TrendName,
10    #[serde(rename = "tweet_count")]
11    TweetCount,
12}
13
14impl TrendFields {
15    pub fn all() -> HashSet<Self> {
16        let mut result = HashSet::new();
17        result.insert(Self::TrendName);
18        result.insert(Self::TweetCount);
19        result
20    }
21}
22
23impl std::fmt::Display for TrendFields {
24    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
25        match self {
26            Self::TrendName => write!(f, "trend_name"),
27            Self::TweetCount => write!(f, "tweet_count"),
28        }
29    }
30}
31