Struct reddit::types::Link

source ·
pub struct Link {
Show 71 fields pub author: Box<str>, pub author_flair_css_class: Option<Box<str>>, pub author_flair_text: Option<Box<str>>, pub clicked: bool, pub domain: Box<str>, pub hidden: bool, pub is_self: bool, pub likes: Option<bool>, pub link_flair_css_class: Option<Box<str>>, pub link_flair_text: Option<Box<str>>, pub locked: bool, pub media: Value, pub media_embed: Value, pub num_comments: u64, pub over_18: bool, pub permalink: Box<str>, pub saved: bool, pub score: i64, pub selftext: Box<str>, pub selftext_html: Option<Box<str>>, pub subreddit: Box<str>, pub subreddit_id: Box<str>, pub thumbnail: Box<str>, pub title: Box<str>, pub url: Box<str>, pub edited: Value, pub distinguished: Option<Box<str>>, pub stickied: bool, pub votable: Votable, pub created: Created, pub archived: bool, pub author_flair_template_id: Option<Box<str>>, pub author_flair_text_color: Option<Box<str>>, pub author_flair_type: Option<Box<str>>, pub author_fullname: Option<Box<str>>, pub author_patreon_flair: Option<bool>, pub can_gild: bool, pub can_mod_post: bool, pub contest_mode: bool, pub crosspost_parent_list: Option<Vec<Link>>, pub gilded: u64, pub hide_score: bool, pub id: Box<str>, pub is_crosspostable: bool, pub is_meta: bool, pub is_original_content: bool, pub is_reddit_media_domain: bool, pub is_robot_indexable: bool, pub is_video: bool, pub link_flair_text_color: Option<Box<str>>, pub link_flair_type: Box<str>, pub media_only: bool, pub name: Box<str>, pub no_follow: bool, pub num_crossposts: u64, pub parent_whitelist_status: Option<Box<str>>, pub pinned: bool, pub post_hint: Option<PostHint>, pub pwls: Option<u64>, pub quarantine: bool, pub send_replies: bool, pub spoiler: bool, pub subreddit_name_prefixed: Box<str>, pub subreddit_subscribers: u64, pub subreddit_type: Box<str>, pub suggested_sort: Option<Box<str>>, pub thumbnail_height: Option<u32>, pub thumbnail_width: Option<u32>, pub visited: bool, pub whitelist_status: Option<Box<str>>, pub wls: Option<u32>,
}
Expand description

Implements votable | created kind == “t3” See https://github.com/reddit-archive/reddit/wiki/JSON#link-implements-votable–created

Fields§

§author: Box<str>

the account name of the poster. null if this is a promotional link

§author_flair_css_class: Option<Box<str>>

the CSS class of the author’s flair. subreddit specific

§author_flair_text: Option<Box<str>>

the text of the author’s flair. subreddit specific

§clicked: bool

probably always returns false

§domain: Box<str>

the domain of this link. Self posts will be self. while other examples include en.wikipedia.org and s3.amazon.com

§hidden: bool

true if the post is hidden by the logged in user. false if not logged in or not hidden.

§is_self: bool

true if this link is a selfpost

§likes: Option<bool>

how the logged-in user has voted on the link - True = upvoted, False = downvoted, null = no vote

§link_flair_css_class: Option<Box<str>>

the CSS class of the link’s flair.

§link_flair_text: Option<Box<str>>

the text of the link’s flair.

§locked: bool

whether the link is locked (closed to new comments) or not.

§media: Value

Used for streaming video. Detailed information about the video and it’s origins are placed here

§media_embed: Value

Used for streaming video. Technical embed specific information is found here.

§num_comments: u64

the number of comments that belong to this link. includes removed comments.

§over_18: bool

true if the post is tagged as NSFW. False if otherwise

§permalink: Box<str>

relative URL of the permanent link for this link

§saved: bool

true if this post is saved by the logged in user

§score: i64

the net-score of the link. note: A submission’s score is simply the number of upvotes minus the number of downvotes. If five users like the submission and three users don’t it will have a score of 2. Please note that the vote numbers are not “real” numbers, they have been “fuzzed” to prevent spam bots etc. So taking the above example, if five users upvoted the submission, and three users downvote it, the upvote/downvote numbers may say 23 upvotes and 21 downvotes, or 12 upvotes, and 10 downvotes. The points score is correct, but the vote totals are “fuzzed”.

§selftext: Box<str>

the raw text. this is the unformatted text which includes the raw markup characters such as ** for bold. <, >, and & are escaped. Empty if not present.

§selftext_html: Option<Box<str>>

the formatted escaped HTML text. this is the HTML formatted version of the marked up text. Items that are boldened by ** or *** will now have or *** tags on them. Additionally, bullets and numbered lists will now be in HTML list format. NOTE: The HTML string will be escaped. You must unescape to get the raw HTML. Null if not present.

§subreddit: Box<str>

subreddit of thing excluding the /r/ prefix. “pics”

§subreddit_id: Box<str>

the id of the subreddit in which the thing is located

§thumbnail: Box<str>

full URL to the thumbnail for this link; “self” if this is a self post; “image” if this is a link to an image but has no thumbnail; “default” if a thumbnail is not available

§title: Box<str>

the title of the link. may contain newlines for some reason

§url: Box<str>

the link of this post. the permalink if this is a self-post. May be a relative Url.

§edited: Value

Indicates if link has been edited. Will be the edit timestamp if the link has been edited and return false otherwise. https://github.com/reddit/reddit/issues/581

§distinguished: Option<Box<str>>

to allow determining whether they have been distinguished by moderators/admins. null = not distinguished. moderator = the green [M]. admin = the red [A]. special = various other special distinguishes http://bit.ly/ZYI47B

§stickied: bool

true if the post is set as the sticky in its subreddit.

§votable: Votable

Voting Implementation

§created: Created

Created Implementation

§archived: bool§author_flair_template_id: Option<Box<str>>§author_flair_text_color: Option<Box<str>>§author_flair_type: Option<Box<str>>§author_fullname: Option<Box<str>>§author_patreon_flair: Option<bool>§can_gild: bool§can_mod_post: bool§contest_mode: bool§crosspost_parent_list: Option<Vec<Link>>

I believe that this is included for crossposted posts to get the data for the main post

§gilded: u64§hide_score: bool§id: Box<str>§is_crosspostable: bool§is_meta: bool§is_original_content: bool§is_reddit_media_domain: bool§is_robot_indexable: bool§is_video: bool

Returns true if its a video

§link_flair_text_color: Option<Box<str>>§link_flair_type: Box<str>§media_only: bool§name: Box<str>§no_follow: bool§num_crossposts: u64§parent_whitelist_status: Option<Box<str>>§pinned: bool

Whether this post is pinned

§post_hint: Option<PostHint>

A “hint” about what this post may be

§pwls: Option<u64>§quarantine: bool§send_replies: bool§spoiler: bool

Whether this post has a spoiler

§subreddit_name_prefixed: Box<str>§subreddit_subscribers: u64§subreddit_type: Box<str>§suggested_sort: Option<Box<str>>§thumbnail_height: Option<u32>§thumbnail_width: Option<u32>§visited: bool§whitelist_status: Option<Box<str>>§wls: Option<u32>

Trait Implementations§

source§

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

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

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

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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 T
where U: From<T>,

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, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

source§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
§

impl<T> WithSubscriber for T

§

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
§

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 T
where T: for<'de> Deserialize<'de>,