Trait rawr::traits::Votable
[−]
[src]
pub trait Votable { fn score(&self) -> i64; fn likes(&self) -> Option<bool>; fn upvote(&self) -> Result<(), APIError>; fn downvote(&self) -> Result<(), APIError>; fn cancel_vote(&self) -> Result<(), APIError>; }
An object that can be voted upon and has a score based on the upvotes - downvotes.
Notes
The ups
and downs
values from the API no longer represent the true upvotes and downvotes,
so this trait does not expose them.
Required Methods
fn score(&self) -> i64
The (fuzzed) points score of the object.
fn likes(&self) -> Option<bool>
Indicates the logged-in user's current vote on this object: - Some(true) = Upvoted - Some(false) = Downvoted - None = No vote
fn upvote(&self) -> Result<(), APIError>
Upvotes the specified post, if possible.
fn downvote(&self) -> Result<(), APIError>
Downvotes the specified post, if possible.
fn cancel_vote(&self) -> Result<(), APIError>
Removes the vote on the specified post, if possible.
Implementors
impl<'a> Votable for Comment<'a>
impl<'a> Votable for Submission<'a>