[−][src]Struct brawl_api::model::brawlers::Brawler
Contains information for a specific brawler, and allows for it to be fetched through
Brawler::fetch
.
Fields
name: String
The brawler's name, in CAPS LOCK. E.g.: "SHELLY"
for Shelly.
id: usize
The brawler's ID (an arbitrary number representing it).
star_powers: Vec<StarPower>
The brawler's star powers, as a vector (note that this does not have a fixed size: new brawlers start with 1 star power, while older ones have at least 2.)
Methods
impl Brawler
[src]
pub fn get_fetch_prop(&self) -> usize
[src]
Returns this Brawler's ID, which is used for fetching.
Examples
use brawl_api::{Brawler, traits::*}; // given an existing Brawler object let brawler: Brawler; assert_eq!(brawler.get_fetch_prop(), brawler.id);
pub fn get_route(id: usize) -> Route
[src]
Returns the Route
object required for fetching a Brawler
instance.
Examples
use brawl_api::{BrawlerList, http::Route}; assert_eq!( BrawlerList::get_route(), Route::Brawlers );
pub fn fetch(client: &Client, id: usize) -> Result<Brawler>
[src]
(Sync) Fetches data for a brawler with a specific ID (see the Brawlers
enum for a
humanized list with IDs).
Errors
This function may error:
- While requesting (will return an
Error::Request
); - After receiving a bad status code (API or other error - returns an
Error::Status
); - After a ratelimit is indicated by the API, while also specifying when it is lifted (
Error::Ratelimited
); - While parsing incoming JSON (will return an
Error::Json
).
(All of those, of course, wrapped inside an Err
.)
Examples
use brawl_api::{Client, Brawler, Brawlers, traits::*}; let my_client = Client::new("my auth token"); let shelly = Brawler::fetch(&my_client, Brawlers::Shelly as usize)?; // now the data for Shelly is available.
pub async fn a_fetch<'_>(client: &'_ Client, id: usize) -> Result<Brawler>
[src]
(Async) Fetches data for a brawler with a specific ID (see the Brawlers
enum for a
humanized list with IDs).
Errors
This function may error:
- While requesting (will return an
Error::Request
); - After receiving a bad status code (API or other error - returns an
Error::Status
); - After a ratelimit is indicated by the API, while also specifying when it is lifted (
Error::Ratelimited
); - While parsing incoming JSON (will return an
Error::Json
).
(All of those, of course, wrapped inside an Err
.)
Examples
use brawl_api::{Client, Brawler, Brawlers, traits::*}; let my_client = Client::new("my auth token"); let shelly = Brawler::a_fetch(&my_client, Brawlers::Shelly as usize).await?; // now the data for Shelly is available.
Trait Implementations
impl Clone for Brawler
[src]
impl Debug for Brawler
[src]
impl Default for Brawler
[src]
fn default() -> Brawler
[src]
Returns an instance of Brawler
with initial values.
Examples
use brawl_api::Brawler; assert_eq!( Brawler::default(), Brawler { name: String::from(""), id: 0, star_powers: vec![] } );
impl<'de> Deserialize<'de> for Brawler
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Brawler
[src]
impl FetchFrom<BattleBrawler> for Brawler
[src]
fn fetch_from(client: &Client, b_brawler: &BattleBrawler) -> Result<Brawler>
[src]
(Sync) Attempts to fetch a Brawler
from an existing BattleBrawler
instance.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
b_brawler: &'life1 BattleBrawler
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
b_brawler: &'life1 BattleBrawler
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Attempts to fetch a Brawler
from an existing BattleBrawler
instance.
impl FetchFrom<Brawlers> for Brawler
[src]
fn fetch_from(client: &Client, b_brawler: &Brawlers) -> Result<Brawler>
[src]
(Sync) Attempts to fetch a Brawler
from an existing Brawlers
variant.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
b_brawler: &'life1 Brawlers
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
b_brawler: &'life1 Brawlers
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Attempts to fetch a Brawler
from an existing Brawlers
variant.
impl FetchFrom<PlayerBrawlerStat> for Brawler
[src]
fn fetch_from(client: &Client, p_brawler: &PlayerBrawlerStat) -> Result<Brawler>
[src]
(Sync) Attempts to fetch a Brawler
from an existing PlayerBrawlerStat
instance.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
p_brawler: &'life1 PlayerBrawlerStat
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
p_brawler: &'life1 PlayerBrawlerStat
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Attempts to fetch a Brawler
from an existing PlayerBrawlerStat
instance.
impl Hash for Brawler
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Brawler> for Brawler
[src]
impl Refetchable for Brawler
[src]
fn refetch(&self, client: &Client) -> Result<Brawler>
[src]
(Sync) Fetches data for this brawler again.
fn a_refetch<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<Brawler>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
(Async) Fetches data for this brawler again.
fn refetch_update(&mut self, client: &Client) -> Result<&Self>
[src]
fn a_refetch_update<'life0, 'async_trait>(
&'async_trait mut self,
client: &'life0 Client
) -> Pin<Box<dyn Future<Output = Result<&'async_trait Self>> + Send + 'async_trait>> where
Self: Send + Sync,
'life0: 'async_trait,
Self: Send + 'async_trait,
[src]
&'async_trait mut self,
client: &'life0 Client
) -> Pin<Box<dyn Future<Output = Result<&'async_trait Self>> + Send + 'async_trait>> where
Self: Send + Sync,
'life0: 'async_trait,
Self: Send + 'async_trait,
impl Serialize for Brawler
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Brawler
[src]
impl StructuralPartialEq for Brawler
[src]
Auto Trait Implementations
impl RefUnwindSafe for Brawler
impl Send for Brawler
impl Sync for Brawler
impl Unpin for Brawler
impl UnwindSafe for Brawler
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> FetchFrom<T> for T where
T: Clone + Send + Sync,
[src]
T: Clone + Send + Sync,
fn fetch_from(&Client, &T) -> Result<T, Error>
[src]
(Sync) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable
.
Errors
Never errors; is only a Result
in order to match the trait signature.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
&'life0 Client,
&'life1 T
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
[src]
&'life0 Client,
&'life1 T
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
(Async) Returns a copy of the current instance when attempting to fetch from itself.
In order to re-fetch, see Refetchable
.
Errors
Never errors; is only a Result
in order to match the trait signature.
impl<T, U> FetchInto<U> for T where
T: Sync + Send,
U: FetchFrom<T> + Sync + Send,
[src]
T: Sync + Send,
U: FetchFrom<T> + Sync + Send,
fn fetch_into(&Self, &Client) -> Result<U, Error>
[src]
fn a_fetch_into<'life0, 'life1, 'async_trait>(
&'life0 Self,
&'life1 Client
) -> Pin<Box<dyn Future<Output = Result<U, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
U: 'async_trait,
[src]
&'life0 Self,
&'life1 Client
) -> Pin<Box<dyn Future<Output = Result<U, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
U: 'async_trait,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Refetchable for T where
T: PropFetchable<Property = <T as GetFetchProp>::Property> + GetFetchProp + Send + Sync,
<T as GetFetchProp>::Property: Sync,
<T as GetFetchProp>::Property: Send,
[src]
T: PropFetchable<Property = <T as GetFetchProp>::Property> + GetFetchProp + Send + Sync,
<T as GetFetchProp>::Property: Sync,
<T as GetFetchProp>::Property: Send,
fn refetch(&Self, &Client) -> Result<T, Error>
[src]
fn a_refetch<'life0, 'life1, 'async_trait>(
&'life0 Self,
&'life1 Client
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
<T as GetFetchProp>::Property: 'async_trait,
[src]
&'life0 Self,
&'life1 Client
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + 'async_trait + Send>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: 'async_trait,
<T as GetFetchProp>::Property: 'async_trait,
fn refetch_update(&mut self, client: &Client) -> Result<&Self>
[src]
fn a_refetch_update<'life0, 'async_trait>(
&'async_trait mut self,
client: &'life0 Client
) -> Pin<Box<dyn Future<Output = Result<&'async_trait Self>> + Send + 'async_trait>> where
Self: Send + Sync,
'life0: 'async_trait,
Self: Send + 'async_trait,
[src]
&'async_trait mut self,
client: &'life0 Client
) -> Pin<Box<dyn Future<Output = Result<&'async_trait Self>> + Send + 'async_trait>> where
Self: Send + Sync,
'life0: 'async_trait,
Self: Send + 'async_trait,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,