Struct rule34::Post

source ·
pub struct Post {
Show 23 fields pub height: NonZeroU64, pub score: i64, pub file_url: Url, pub parent_id: Option<NonZeroU64>, pub sample_url: Url, pub sample_width: NonZeroU64, pub sample_height: NonZeroU64, pub preview_url: Url, pub rating: Rating, pub tags: Box<str>, pub id: NonZeroU64, pub width: NonZeroU64, pub change: OffsetDateTime, pub md5: Md5Digest, pub creator_id: NonZeroU64, pub has_children: bool, pub created_at: OffsetDateTime, pub status: PostStatus, pub source: Option<Box<str>>, pub has_notes: bool, pub has_comments: bool, pub preview_width: NonZeroU64, pub preview_height: NonZeroU64,
}
Expand description

A Post

Fields§

§height: NonZeroU64

The height of the original file.

§score: i64

The number of up-votes minus the number of down-votes.

§file_url: Url

The main file url

§parent_id: Option<NonZeroU64>

The parent post id

§sample_url: Url

The sample url

§sample_width: NonZeroU64

The sample width

§sample_height: NonZeroU64

The sample height

§preview_url: Url

The preview url

§rating: Rating

The image rating

§tags: Box<str>

A list of tag names.

Tag names are separated by one or more spaces. There may or may not be a leading or trailing space. Tag names are always lowercase.

§id: NonZeroU64

The id the post

§width: NonZeroU64

image width

§change: OffsetDateTime

The time of the last change.

This tracks at least the date of posting and tag edits. This is a unix timestamp.

§md5: Md5Digest

The md5 hash of the file.

§creator_id: NonZeroU64

The creator id.

§has_children: bool

Whether this has children.

§created_at: OffsetDateTime

The creation date of the post.

§status: PostStatus

The status of the post.

§source: Option<Box<str>>

The original source.

May or may not be a url, it is filled manually by users.

§has_notes: bool

Whether the post has notes.

§has_comments: bool

Whether this post has comments.

§preview_width: NonZeroU64

The preview image width.

§preview_height: NonZeroU64

The preview image height.

Implementations§

source§

impl Post

source

pub fn iter_tags(&self) -> impl Iterator<Item = &str>

Iter over the tags in this object.

There may be duplicate tags included.

source

pub fn get_html_post_url(&self) -> Url

Get the html post url for this post.

This allocates, so cache the result.

Trait Implementations§

source§

impl Debug for Post

source§

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

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

impl<'de> Deserialize<'de> for Post

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 Serialize for Post

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 Post

§

impl Send for Post

§

impl Sync for Post

§

impl Unpin for Post

§

impl UnwindSafe for Post

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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