Struct egg_mode::tweet::Tweet

source ·
pub struct Tweet {
Show 28 fields pub coordinates: Option<(f64, f64)>, pub created_at: DateTime<Utc>, pub current_user_retweet: Option<u64>, pub display_text_range: Option<(usize, usize)>, pub entities: TweetEntities, pub extended_entities: Option<ExtendedTweetEntities>, pub favorite_count: i32, pub favorited: Option<bool>, pub filter_level: Option<FilterLevel>, pub id: u64, pub in_reply_to_user_id: Option<u64>, pub in_reply_to_screen_name: Option<String>, pub in_reply_to_status_id: Option<u64>, pub lang: Option<String>, pub place: Option<Place>, pub possibly_sensitive: Option<bool>, pub quoted_status_id: Option<u64>, pub quoted_status: Option<Box<Tweet>>, pub retweet_count: i32, pub retweeted: Option<bool>, pub retweeted_status: Option<Box<Tweet>>, pub source: Option<TweetSource>, pub text: String, pub truncated: bool, pub user: Option<Box<TwitterUser>>, pub withheld_copyright: bool, pub withheld_in_countries: Option<Vec<String>>, pub withheld_scope: Option<String>,
}
Expand description

Represents a single status update.

The fields present in this struct can be mainly split up based on the context they’re present for.

Base Tweet Info

This information is the basic information inherent to all tweets, regardless of context.

  • text
  • id
  • created_at
  • user
  • source
  • favorite_count/retweet_count
  • lang, though third-party clients usually don’t surface this at a user-interface level. Twitter Web uses this to create machine-translations of the tweet.
  • coordinates/place
  • display_text_range
  • truncated

Perspective-based data

This information depends on the authenticated user who called the data. These are left as Options because certain contexts where the information is pulled either don’t have an authenticated user to compare with, or don’t have to opportunity to poll the user’s interactions with the tweet.

  • favorited
  • retweeted
  • current_user_retweet

Replies

This information is only present when the tweet in question is marked as being a reply to another tweet, or when it’s threaded into a chain from the same user.

  • in_reply_to_user_id/in_reply_to_screen_name
  • in_reply_to_status_id

Retweets and Quote Tweets

This information is only present when the tweet in question is a native retweet or is a “quote tweet” that references another tweet by linking to it. These fields allow you to reference the parent tweet without having to make another call to show.

  • retweeted_status
  • quoted_status/quoted_status_id

Media

As a tweet can attach an image, GIF, or video, these fields allow you to access information about the attached media. Note that polls are not surfaced to the Public API at the time of this writing (2016-09-01). For more information about how to use attached media, see the documentation for MediaEntity.

  • entities (note that this also contains information about hyperlinks, user mentions, and hashtags in addition to a picture/thumbnail)
  • extended_entities: This field is only present for tweets with attached media, and houses more complete media information, in the case of a photo set, video, or GIF. For videos and GIFs, note that entities will only contain a thumbnail, and the actual video links will be in this field. For tweets with more than one photo attached, entities will only contain the first photo, and this field will contain all of them.
  • possibly_sensitive
  • withheld_copyright
  • withheld_in_countries
  • withheld_scope

Fields§

§coordinates: Option<(f64, f64)>

If present, the location coordinate attached to the tweet, as a (latitude, longitude) pair.

§created_at: DateTime<Utc>

UTC timestamp from when the tweet was posted.

§current_user_retweet: Option<u64>

If the authenticated user has retweeted this tweet, contains the ID of the retweet.

§display_text_range: Option<(usize, usize)>

If this tweet is an extended tweet with “hidden” metadata and entities, contains the byte offsets between which the “displayable” tweet text is.

§entities: TweetEntities

Link, hashtag, and user mention information extracted from the tweet text.

§extended_entities: Option<ExtendedTweetEntities>

Extended media information attached to the tweet, if media is available.

If a tweet has a photo, set of photos, gif, or video attached to it, this field will be present and contain the real media information. The information available in the media field of entities will only contain the first photo of a set, or a thumbnail of a gif or video.

§favorite_count: i32

“Approximately” how many times this tweet has been liked by users.

§favorited: Option<bool>

Indicates whether the authenticated user has liked this tweet.

§filter_level: Option<FilterLevel>

Indicates the maximum FilterLevel parameter that can be applied to a stream and still show this tweet.

§id: u64

Numeric ID for this tweet.

§in_reply_to_user_id: Option<u64>

If the tweet is a reply, contains the ID of the user that was replied to.

§in_reply_to_screen_name: Option<String>

If the tweet is a reply, contains the screen name of the user that was replied to.

§in_reply_to_status_id: Option<u64>

If the tweet is a reply, contains the ID of the tweet that was replied to.

§lang: Option<String>

Can contain a language ID indicating the machine-detected language of the text, or “und” if no language could be detected.

§place: Option<Place>

When present, the Place that this tweet is associated with (but not necessarily where it originated from).

§possibly_sensitive: Option<bool>

If the tweet has a link, indicates whether the link may contain content that could be identified as sensitive.

§quoted_status_id: Option<u64>

If this tweet is quoting another by link, contains the ID of the quoted tweet.

§quoted_status: Option<Box<Tweet>>

If this tweet is quoting another by link, contains the quoted tweet.

§retweet_count: i32

The number of times this tweet has been retweeted (with native retweets).

§retweeted: Option<bool>

Indicates whether the authenticated user has retweeted this tweet.

§retweeted_status: Option<Box<Tweet>>

If this tweet is a retweet, then this field contains the original status information.

The separation between retweet and original is so that retweets can be recalled by deleting the retweet, and so that liking a retweet results in an additional notification to the user who retweeted the status, as well as the original poster.

§source: Option<TweetSource>

The application used to post the tweet.

§text: String

The text of the tweet. For “extended” tweets, opening reply mentions and/or attached media or quoted tweet links do not count against character count, so this could be longer than 280 characters in those situations.

§truncated: bool

Indicates whether this tweet is a truncated “compatibility” form of an extended tweet whose full text is longer than 280 characters.

§user: Option<Box<TwitterUser>>

The user who posted this tweet. This field will be absent on tweets included as part of a TwitterUser.

§withheld_copyright: bool

If present and true, indicates that this tweet has been withheld due to a DMCA complaint.

§withheld_in_countries: Option<Vec<String>>

If present, contains two-letter country codes indicating where this tweet is being withheld.

The following special codes exist:

  • XX: Withheld in all countries
  • XY: Withheld due to DMCA complaint.
§withheld_scope: Option<String>

If present, indicates whether the content being withheld is the status or the user.

Trait Implementations§

source§

impl Clone for Tweet

source§

fn clone(&self) -> Tweet

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Tweet

source§

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

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

impl<'de> Deserialize<'de> for Tweet

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,

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

impl RoundTrip for Tweet

source§

fn upstream_deser_error(input: Value) -> Option<String>

Returns the string representation of an error from loading JSON from Twitter, if applicable. Read more
source§

fn roundtrip_deser_error(input: Value) -> Option<String>

Returns the string representation of an error from loading JSON given by serializing this type. Read more
source§

impl Serialize for Tweet

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where
    __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Tweet

§

impl Send for Tweet

§

impl Sync for Tweet

§

impl Unpin for Tweet

§

impl UnwindSafe for Tweet

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> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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>,