1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use serde_derive::{Deserialize, Serialize}; use std::str::FromStr; mod model; mod util; pub use crate::model::*; impl FromStr for TwitterResponse { type Err = serde_json::error::Error; fn from_str(s: &str) -> Result<Self, Self::Err> { serde_json::from_str(s) } } #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum TwitterResponse { Tweet(Tweet), Limit(Limit), }