SearchBuilder

Struct SearchBuilder 

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

Implementations§

Source§

impl SearchBuilder

Source

pub fn new(name: &str, limit: u32) -> Self

Takes an anime name and limiter, and initializes a search entry retriever for the corresponding anime

Source

pub async fn run(&self) -> Result<MalAnimeSearch, Box<dyn Error>>

Calls the MyAnimeList API to recieve anime created by the builder, based on the name, a limiter, and fields added from the other methods.
The user does not need to be logged in, aside from using the .add_my_list_status() to the result.
This method returns a Result, containing either the data in a MalAnimeSearch, or an error.

§Example usage:
use mal_query::myanimelist::builders::{SearchBuilder, AddFields};
async fn search_builder_example() {
    let berserk = SearchBuilder::new("berserk", 1)
        .add_start_date()
        .add_rank()
        .run()
        .await;
    match berserk {
        Err(_e) => assert!(false),
        Ok(data_vec) => {
            let data = data_vec.get(0).unwrap();
            assert!(
                data
                .title
                .to_lowercase()
                .contains("berserk")
            );
            assert_eq!(data.id, 33);
        }
    }
}

Trait Implementations§

Source§

impl AddFields for SearchBuilder

Source§

fn add_id(&mut self) -> &mut Self

Adds the option of an Id to be given to the final result

Source§

fn add_title(&mut self) -> &mut Self

Adds the option of a title to be given to the final result

Source§

fn add_main_picture(&mut self) -> &mut Self

Adds the option of a Main Picture to be given to the final result

Source§

fn add_alt_titles(&mut self) -> &mut Self

Adds the option of Alternate Titles to be given to the final result

Source§

fn add_start_date(&mut self) -> &mut Self

Adds the option of a Start Date to be given to the final result

Source§

fn add_end_date(&mut self) -> &mut Self

Adds the option of an End Date to be given to the final result

Source§

fn add_synopsis(&mut self) -> &mut Self

Adds the option of a Synopsis to be given to the final result

Source§

fn add_mean(&mut self) -> &mut Self

Adds the option of a Mean to be given to the final result

Source§

fn add_rank(&mut self) -> &mut Self

Adds the option of a Rank to be given to the final result

Source§

fn add_popularity(&mut self) -> &mut Self

Adds the option of Popularity to be given to the final result

Source§

fn add_num_list_users(&mut self) -> &mut Self

Adds the option of Num. List Users to be given to the final result

Source§

fn add_num_scoring_users(&mut self) -> &mut Self

Adds the option of Num. Scoring Users to be given to the final result

Source§

fn add_nsfw(&mut self) -> &mut Self

Adds the option of NSFW rating to be given to the final result

Source§

fn add_created_at(&mut self) -> &mut Self

Adds the option of a Created Date to be given to the final result

Source§

fn add_updated_at(&mut self) -> &mut Self

Adds the option of an Updated Date to be given to the final result

Source§

fn add_media_type(&mut self) -> &mut Self

Adds the option of a Media Type to be given to the final result

Source§

fn add_status(&mut self) -> &mut Self

Adds the option of the Airing Status to be given to the final result

Source§

fn add_genres(&mut self) -> &mut Self

Adds the option of Genres to be given to the final result

Source§

fn add_my_list_status(&mut self) -> &mut Self

Adds the option of your List Status to be given to the final result

Source§

fn add_start_season(&mut self) -> &mut Self

Adds the option of Start Season data to be given to the final result

Source§

fn add_num_episodes(&mut self) -> &mut Self

Adds the option of an Episode Count to be given to the final result

Source§

fn add_broadcast(&mut self) -> &mut Self

Adds the option of Broadcast data to be given to the final result

Source§

fn add_source(&mut self) -> &mut Self

Adds the option of Source data to be given to the final result

Source§

fn add_average_episode_duration(&mut self) -> &mut Self

Adds the option of an Average Episode Duration to be given to the final result

Source§

fn add_rating(&mut self) -> &mut Self

Adds the option of a Rating type to be given to the final result

Source§

fn add_pictures(&mut self) -> &mut Self

Adds the option of MyAnimeList’s Pictures to be given to the final result

Source§

fn add_background(&mut self) -> &mut Self

Adds the option of the show’s Background to be given to the final result

Adds the option of Related Anime to be given to the final result

Adds the option of Related Manga to be given to the final result

Source§

fn add_recommendations(&mut self) -> &mut Self

Adds the option of Recommendations to be given to the final result

Source§

fn add_studios(&mut self) -> &mut Self

Adds the option of Studio data to be given to the final result

Source§

fn add_statistics(&mut self) -> &mut Self

Adds the option of MyAnimeList Statistics to be given to the final result

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