pub struct Post {Show 15 fields
pub id: Id,
pub created: u128,
pub content: String,
pub owner: Id,
pub context: PostContext,
pub replying_to: Option<Id>,
pub likes: isize,
pub dislikes: isize,
pub comment_count: usize,
pub uploads: Vec<usize>,
pub is_deleted: bool,
pub poll_id: Option<Id>,
pub views: usize,
pub group: Option<Id>,
pub limited_reach: bool,
}Fields§
§id: Id§created: u128§content: String§owner: IdThe ID of the owner of this post.
context: PostContextExtra information about the post.
replying_to: Option<Id>The ID of the post this post is a comment on.
likes: isize§dislikes: isize§comment_count: usize§uploads: Vec<usize>IDs of all uploads linked to this post.
is_deleted: boolIf the post was deleted.
poll_id: Option<Id>The ID of the poll associated with this post.
views: usize§group: Option<Id>§limited_reach: boolImplementations§
Source§impl Post
impl Post
Sourcepub fn new(
content: String,
replying_to: Option<Id>,
owner: Id,
poll_id: Option<Id>,
group: Option<Id>,
) -> Self
pub fn new( content: String, replying_to: Option<Id>, owner: Id, poll_id: Option<Id>, group: Option<Id>, ) -> Self
Create a new Post.
Sourcepub fn repost(content: String, owner: Id, post_id: Id) -> Self
pub fn repost(content: String, owner: Id, post_id: Id) -> Self
Create a new Post (as a repost of the given post_id).
Sourcepub fn mark_as_repost(&mut self)
pub fn mark_as_repost(&mut self)
Make the given post a reposted post.
Sourcepub fn can_comment(&self) -> bool
pub fn can_comment(&self) -> bool
Check if a particular user can comment on this post.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Post
impl<'de> Deserialize<'de> for Post
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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§
impl Freeze for Post
impl RefUnwindSafe for Post
impl Send for Post
impl Sync for Post
impl Unpin for Post
impl UnsafeUnpin for Post
impl UnwindSafe for Post
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more