rust_anilist::models

Struct Person

Source
pub struct Person {
Show 18 fields pub id: i64, pub name: Name, pub language: Language, pub image: Option<Image>, pub description: Option<String>, pub primary_occupations: Option<Vec<String>>, pub gender: Gender, pub date_of_birth: Option<Date>, pub date_of_death: Option<Date>, pub age: Option<i64>, pub home_town: Option<String>, pub blood_type: Option<String>, pub is_favourite: Option<bool>, pub is_favourite_blocked: Option<bool>, pub url: String, pub characters: Option<Vec<Character>>, pub favourites: i64, pub mod_notes: Option<String>, /* private fields */
}
Expand description

Represents a person.

Fields§

§id: i64

The ID of the person.

§name: Name

The name of the person.

§language: Language

The language of the person.

§image: Option<Image>

The image of the person, if any.

§description: Option<String>

The description of the person, if any.

§primary_occupations: Option<Vec<String>>

The primary occupations of the person, if any.

§gender: Gender

The gender of the person.

§date_of_birth: Option<Date>

The date of birth of the person, if any.

§date_of_death: Option<Date>

The date of death of the person, if any.

§age: Option<i64>

The age of the person, if any.

§home_town: Option<String>

The hometown of the person, if any.

§blood_type: Option<String>

The blood type of the person, if any.

§is_favourite: Option<bool>

Whether the person is a favorite, if any.

§is_favourite_blocked: Option<bool>

Whether the person is blocked from being a favorite, if any.

§url: String

The URL of the person’s site.

§characters: Option<Vec<Character>>

The characters associated with the person, if any.

§favourites: i64

The number of favorites the person has.

§mod_notes: Option<String>

The moderator notes for the person, if any.

Implementations§

Source§

impl Person

Source

pub async fn load_full(self) -> Result<Self>

Loads the full details of the person.

§Errors

Returns an error if the person details cannot be loaded.

§Panics

Panics if the person is already fully loaded.

§Example
let person = person.load_full().await?;
Source

pub async fn get_medias<T>(&self) -> Result<T>

Retrieves the media associated with the person.

§Errors

Returns an error if the media cannot be retrieved.

§Type Parameters
  • T - The type of the media to be returned.
§Example
let animes = person.get_medias::<Anime>().await?;
Source

pub async fn get_character_medias<T>(&self, _character_id: i64) -> Result<T>

Retrieves the media associated with a character.

§Arguments
  • character_id - The ID of the character whose media is to be retrieved.
§Errors

Returns an error if the media cannot be retrieved.

§Type Parameters
  • T - The type of the media to be returned.
§Example
let char_mangas = person.get_character_medias::<Manga>(1).await?;

Trait Implementations§

Source§

impl Clone for Person

Source§

fn clone(&self) -> Person

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Person

Source§

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

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

impl Default for Person

Source§

fn default() -> Person

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Person

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 PartialEq for Person

Source§

fn eq(&self, other: &Person) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Person

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
Source§

impl StructuralPartialEq for Person

Auto Trait Implementations§

§

impl Freeze for Person

§

impl RefUnwindSafe for Person

§

impl Send for Person

§

impl Sync for Person

§

impl Unpin for Person

§

impl UnwindSafe for Person

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T