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(UserIdBox<StreamMessage<'a>>),
    Custom(JsonMap<String, JsonValue>),
}

Represents a message from Twitter Streaming API.

Reference

  1. Streaming message types — Twitter Developers

Variants

Tweet

Notifications about non-Tweet events.

Indicate that a given Tweet has been deleted.

Indicate that geolocated data must be stripped from a range of Tweets.

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.

Indicate that a given tweet has had its content withheld.

Indicate that a user has had their content withheld.

This message is sent when a stream is disconnected, indicating why the stream was closed.

Variout warning message

List of the user's friends. Only be sent upon establishing a User Stream connection.

Direct message

A [control URI][1] for Site Streams. [1]: https://dev.twitter.com/streaming/sitestreams/controlstreams

An [envelope][1] for Site Stream. [1]: https://dev.twitter.com/streaming/overview/messages-types#envelopes_for_user

A message not known to this library.

Methods

impl<'a> StreamMessage<'a>
[src]

[src]

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]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<'a> Debug for StreamMessage<'a>
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a> PartialEq for StreamMessage<'a>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<'de: 'a, 'a> Deserialize<'de> for StreamMessage<'a>
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations

impl<'a> Send for StreamMessage<'a>

impl<'a> Sync for StreamMessage<'a>