Enum twitter_stream_message::message::StreamMessage
[−]
[src]
pub enum StreamMessage<'a> {
Tweet(Box<Tweet<'a>>),
Event(Box<Event<'a>>),
Delete(Delete),
ScrubGeo(ScrubGeo),
Limit(Limit),
StatusWithheld(StatusWithheld<'a>),
UserWithheld(UserWithheld<'a>),
Disconnect(Disconnect<'a>),
Warning(Warning<'a>),
Friends(Friends),
DirectMessage(Box<DirectMessage<'a>>),
Control(Control<'a>),
ForUser(UserId, Box<StreamMessage<'a>>),
Custom(JsonMap<String, JsonValue>),
}Represents a message from Twitter Streaming API.
Reference
Variants
Tweet(Box<Tweet<'a>>)Tweet
Event(Box<Event<'a>>)Notifications about non-Tweet events.
Delete(Delete)Indicate that a given Tweet has been deleted.
ScrubGeo(ScrubGeo)Indicate that geolocated data must be stripped from a range of Tweets.
Limit(Limit)Indicate that a filtered stream has matched more Tweets than its current rate limit allows to be delivered, noticing a total count of the number of undelivered Tweets since the connection was opened.
StatusWithheld(StatusWithheld<'a>)Indicate that a given tweet has had its content withheld.
UserWithheld(UserWithheld<'a>)Indicate that a user has had their content withheld.
Disconnect(Disconnect<'a>)This message is sent when a stream is disconnected, indicating why the stream was closed.
Warning(Warning<'a>)Variout warning message
Friends(Friends)List of the user's friends. Only be sent upon establishing a User Stream connection.
DirectMessage(Box<DirectMessage<'a>>)Direct message
Control(Control<'a>)A control URI for Site Streams.
ForUser(UserId, Box<StreamMessage<'a>>)An envelope for Site Stream.
Custom(JsonMap<String, JsonValue>)A message not known to this library.
Methods
impl<'a> StreamMessage<'a>[src]
fn from_str(json: &'a str) -> Result<Self>
Parse a JSON string returned from Twitter Streaming API.
Note that this method is not a member of the FromStr trait.
It is because the method requires the lifetime information of the JSON string,
while FromStr::from_str does not take a lifetime parameter.
use twitter_stream_message::message::{Delete, StreamMessage}; let parsed = StreamMessage::from_str(r#"{ "delete":{ "status":{ "id":1234, "id_str":"1234", "user_id":3, "user_id_str":"3" } } }"#).unwrap(); let expected = StreamMessage::Delete(Delete { id: 1234, user_id: 3, }); assert_eq!(parsed, expected);
Trait Implementations
impl<'a> Clone for StreamMessage<'a>[src]
fn clone(&self) -> StreamMessage<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl<'a> Debug for StreamMessage<'a>[src]
impl<'a> PartialEq for StreamMessage<'a>[src]
fn eq(&self, __arg_0: &StreamMessage<'a>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &StreamMessage<'a>) -> bool
This method tests for !=.
impl<'de: 'a, 'a> Deserialize<'de> for StreamMessage<'a>[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more