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