UpdateAnime

Struct UpdateAnime 

Source
pub struct UpdateAnime { /* private fields */ }

Implementations§

Source§

impl UpdateAnime

Source

pub fn new(id: u32) -> Self

Takes an anime id, and initializes data for an update

Source

pub fn from_malanimedata(mal_data: &MalAnimeData) -> Self

Takes an existing MalAnimeData variable, and initializes data for an update

Source

pub async fn update(&mut self) -> Result<ListStatus, Box<dyn Error>>

Calls the MyAnimeList API to update the user’s anime entry based on the fields the other methods implement.
The user must first be logged in, for the app to have received a Token from MyAnimList.
Example usage:

use mal_query::myanimelist::user::UpdateAnime;
async fn update_example() {
    let status = UpdateAnime::new(33)
        .update_score(10)
        .expect("Score should be between 0-10")
        .update()
        .await
        .unwrap(); // Assuming successful
    assert_eq!(status.score, 10);
}
Source

pub fn update_status(&mut self, new_status: Status) -> &mut Self

Adds an update to the user’s status to the Update

Source

pub fn update_is_rewatching(&mut self, new_is_rewatching: bool) -> &mut Self

Adds an update to the user’s is_rewatching to the Update

Source

pub fn update_score( &mut self, new_score: u32, ) -> Result<&mut Self, Box<dyn Error>>

Adds an update to the user’s score to the Update

Source

pub fn update_num_watched_episodes( &mut self, new_num_watched_episodes: u32, ) -> &mut Self

Adds an update to the user’s number of watched episodes to the Update

Source

pub fn update_priority( &mut self, new_priority: u32, ) -> Result<&mut Self, Box<dyn Error>>

Adds an update to the user’s personal priority to the Update

Source

pub fn update_num_times_rewatched( &mut self, new_num_times_rewatched: u32, ) -> &mut Self

Adds an update to the user’s number of times rewatched to the Update

Source

pub fn update_rewatch_value( &mut self, new_rewatch_value: u32, ) -> Result<&mut Self, Box<dyn Error>>

Adds an update to the user’s rewatch value to the Update

Source

pub fn update_tags(&mut self, new_tags: Vec<&str>) -> &mut Self

Overrides the tags of the user’s anime entry

§WARNING:

This will change all tags into ONLY what the params are

Source

pub fn update_comments(&mut self, new_comments: &str) -> &mut Self

Overrides the comment of the user’s anime entry

Source

pub fn update_start_date( &mut self, new_year: u32, new_month: u32, new_day: u32, ) -> &mut Self

Changes the Starting Date of the user’s entry

§WARNING:

A date beyond today’s date given to the MyAnimeList API will simply ignore the parameter.

Source

pub fn update_finish_date( &mut self, new_year: u32, new_month: u32, new_day: u32, ) -> &mut Self

Changes the Finish Date of the user’s entry

§WARNING:

An date beyond today’s date given to the MyAnimeList API will simply ignore the parameter.

Trait Implementations§

Source§

impl Debug for UpdateAnime

Source§

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

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

impl<'de> Deserialize<'de> for UpdateAnime

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.

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 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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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