pub enum StreamMessage {
    Ping,
    FriendList(Vec<u64>),
    Tweet(Tweet),
    Delete {
        status_id: u64,
        user_id: u64,
    },
    ScrubGeo {
        user_id: u64,
        up_to_status_id: u64,
    },
    StatusWithheld {
        status_id: u64,
        user_id: u64,
        withheld_in_countries: Vec<String>,
    },
    UserWithheld {
        user_id: u64,
        withheld_in_countries: Vec<String>,
    },
    Disconnect(u64String),
    Unknown(Value),
}
Expand description

Represents the kinds of messages that can be sent over Twitter’s Streaming API.

Variants§

§

Ping

A blank line, sent periodically to keep the connection alive.

§

FriendList(Vec<u64>)

A list of accounts the authenticated user follows, sent at the beginning of the session for user streams.

§

Tweet(Tweet)

A new tweet.

Note that the entities inside the user field will be empty for tweets received via the Streaming API.

§

Delete

Fields

§status_id: u64

The status that was deleted.

§user_id: u64

The user that deleted the status.

Notice given when a user deletes a post.

Clients are expected to comply with these notices by removing the status “from memory and any storage or archive, even in the rare case where a deletion message arrives earlier in the stream than the Tweet it references.”

§

ScrubGeo

Fields

§user_id: u64

The user whose geolocation information needs to be scrubbed.

§up_to_status_id: u64

The last status ID to scrub information from.

Notice given when a user removes geolocation information from their profile.

Clients are expected to comply by deleting cached geolocation information from tweets by the given user, for any tweets up to and including the given status ID. According to Twitter’s documentation, “These messages may also arrive before a Tweet which falls into the specified range, although this is rare.”

§

StatusWithheld

Fields

§status_id: u64

The status that was withheld.

§user_id: u64

The user that posted the status.

§withheld_in_countries: Vec<String>

A list of uppercase two-character country codes listing the countries where the tweet was withheld.

Placeholder message used to indicate that a specific tweet has been withheld in certain countries.

§

UserWithheld

Fields

§user_id: u64

The user whose content was withheld.

§withheld_in_countries: Vec<String>

A list of uppercase two-character country codes listing the countries where the content was withheld.

Placeholder message used to indicate that a specific user’s content has been withheld in certain countries.

§

Disconnect(u64String)

An error message that may be delivered immediately prior to Twitter disconnecting the stream.

Note that if the stream is disconnected due to network issues or the client reading messages too slowly, it’s possible that this message may not be received.

The enclosed values are an error code and error description. A non-exhaustive list of error codes and their associated reasons are available on Twitter’s stream docmentation, under “Disconnect messages (disconnect)”.

§

Unknown(Value)

An unhandled message payload.

Twitter can add new streaming messages to the API, and egg-mode includes them here so that they can be used before egg-mode has a chance to handle them.

Trait Implementations§

source§

impl Debug for StreamMessage

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for StreamMessage

source§

fn deserialize<D>(deser: D) -> Result<StreamMessage, D::Error>where
    D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl FromStr for StreamMessage

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(input: &str) -> Result<Self, Error>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere
    V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
    S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere
    T: for<'de> Deserialize<'de>,