[−][src]Struct brawl_api::model::players::player::Player
A struct representing a Brawl Stars player, with all of its data.
Use Player::fetch
to fetch one based on tag. (Make sure the PropFetchable
trait
is imported - in general, it is recommended to at least use brawl_api::traits::*
, or,
even, use brawl_api::prelude::*
to bring the models into scope as well.)
Fields
club: Option<PlayerClub>
The club the Player is in (as a PlayerClub
instance), or None if none.
is_qualified_from_championship_challenge: bool
Whether or not the Player was qualified from the Championship challenge (2020).
tvt_victories: usize
Amount of 3v3 victories the Player has earned.
tag: String
The player's tag. Note: this includes the initial '#'.
name: String
The player's name.
trophies: usize
The player's current trophies.
highest_trophies: usize
The player's highest trophies amount.
exp_level: usize
The player's experience level.
exp_points: usize
The player's experience points.
power_play_points: usize
The player's current power play points.
highest_power_play_points: usize
The player's highest power play points.
solo_victories: usize
The player's victories in solo showdown (how many times ranked #1).
duo_victories: usize
The player's victories in duo showdown (how many times ranked #1).
best_robo_rumble_time: usize
The player's best Robo Rumble time, in seconds.
best_time_as_big_brawler: usize
The player's best time as a Big Brawler, in seconds.
brawlers: Vec<PlayerBrawlerStat>
The player's brawlers.
name_color: u64
The player's name color, as an integer (Default is 0xffffff = 16777215 - this is used when the data is not available).
Trait Implementations
impl Clone for Player
[src]
impl Debug for Player
[src]
impl Default for Player
[src]
impl<'de> Deserialize<'de> for Player
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Player
[src]
impl FetchFrom<BattlePlayer> for Player
[src]
fn fetch_from(client: &Client, b_player: &BattlePlayer) -> Result<Player>
[src]
(Async) Fetches a Player
instance, given a preexisting BattlePlayer
instance.
Errors
See Player::fetch
.
Examples
use brawl_api::{ Client, Player, BattleLog, Battle, BattleResultInfo, BattlePlayer, traits::* }; let my_client = Client::new("my auth token"); let battlelog = BattleLog::fetch(&my_client, "#PLAYER_TAG_HERE")?; let most_recent_battle: Option<&Battle> = battlelog.get(0); if let Some(battle) = most_recent_battle { if let Some(ref teams) = &battle.result.teams { let some_b_player: &BattlePlayer = &teams[0][0]; let some_player = Player::fetch_from(&my_client, some_b_player)?; // now `some_b_player`'s full data, as a Player, is available for use. } }
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
b_player: &'life1 BattlePlayer
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
b_player: &'life1 BattlePlayer
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Fetches a Player
instance, given a preexisting BattlePlayer
instance.
Errors
See Player::fetch
.
Examples
use brawl_api::{ Client, Player, BattleLog, Battle, BattleResultInfo, BattlePlayer, traits::* }; let my_client = Client::new("my auth token"); let battlelog = BattleLog::a_fetch(&my_client, "#PLAYER_TAG_HERE").await?; let most_recent_battle: Option<&Battle> = battlelog.get(0); if let Some(battle) = most_recent_battle { if let Some(ref teams) = &battle.result.teams { let some_b_player: &BattlePlayer = &teams[0][0]; let some_player = Player::a_fetch_from(&my_client, some_b_player).await?; // now `some_b_player`'s full data, as a Player, is available for use. } }
impl FetchFrom<ClubMember> for Player
[src]
fn fetch_from(client: &Client, member: &ClubMember) -> Result<Player>
[src]
(Sync) Fetches a Player
instance, given a preexisting ClubMember
instance.
Errors
See Player::fetch
.
Examples
use brawl_api::{Client, Player, Club, traits::*}; let my_client = Client::new("my auth token"); let club = Club::fetch(&my_client, "#CLUB_TAG_HERE")?; let some_member = &club.members[0]; let some_player = Player::fetch_from(&my_client, some_member)?; // now `some_member`'s full data, as a Player, is available for use.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
member: &'life1 ClubMember
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
member: &'life1 ClubMember
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Fetches a Player
instance, given a preexisting ClubMember
instance.
Errors
See Player::fetch
.
Examples
use brawl_api::{Client, Player, Club, traits::*}; let my_client = Client::new("my auth token"); let club = Club::a_fetch(&my_client, "#CLUB_TAG_HERE").await?; let some_member = &club.members[0]; let some_player = Player::a_fetch_from(&my_client, some_member).await?; // now `some_member`'s full data, as a Player, is available for use.
impl FetchFrom<Player> for BattleLog
[src]
fn fetch_from(client: &Client, player: &Player) -> Result<BattleLog>
[src]
(Sync) Fetches a given player's battlelog (a BattleLog
instance) by using data from
an existing Player
instance. (See BattleLog::fetch
for more details.)
Note that this is simply to minimize efforts when a player was already fetched. If
no Player
instance was previously present, it is recommended to simply BattleLog::fetch
with the specific player's tag.
Examples
use brawl_api::{Client, Player, BattleLog, traits::*}; let my_client = Client::new("my auth token"); let player = Player::fetch(&my_client, "#PLAYERTAGHERE")?; // do stuff with player... let player_battlelog = BattleLog::fetch_from(&my_client, &player)?; // now the player's battlelog is available for use
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
player: &'life1 Player
) -> Pin<Box<dyn Future<Output = Result<BattleLog>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
player: &'life1 Player
) -> Pin<Box<dyn Future<Output = Result<BattleLog>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Fetches a given player's battlelog (a BattleLog
instance) by using data from
an existing Player
instance. (See BattleLog::fetch
for more details.)
Note that this is simply to minimize efforts when a player was already fetched. If
no Player
instance was previously present, it is recommended to simply BattleLog::fetch
with the specific player's tag.
Examples
use brawl_api::{Client, Player, BattleLog, traits::*}; let my_client = Client::new("my auth token"); let player = Player::a_fetch(&my_client, "#PLAYERTAGHERE").await?; // do stuff with player... let player_battlelog = BattleLog::a_fetch_from(&my_client, &player).await?; // now the player's battlelog is available for use
impl FetchFrom<PlayerRanking> for Player
[src]
fn fetch_from(client: &Client, p_ranking: &PlayerRanking) -> Result<Player>
[src]
(Sync) Fetches a Player
using data from a PlayerRanking
object.
fn a_fetch_from<'life0, 'life1, 'async_trait>(
client: &'life0 Client,
p_ranking: &'life1 PlayerRanking
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
[src]
client: &'life0 Client,
p_ranking: &'life1 PlayerRanking
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
(Async) Fetches a Player
using data from a PlayerRanking
object.
impl GetFetchProp for Player
[src]
impl Hash for Player
[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<Player> for Player
[src]
impl PropFetchable for Player
[src]
type Property = str
fn fetch(client: &Client, tag: &str) -> Result<Player>
[src]
(Sync) Fetches a player from its tag.
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, Player, traits::*}; let my_client = Client::new("my auth token"); let player = Player::fetch(&my_client, "#PLAYERTAGHERE")?; // now the data for the given player is available for use
fn a_fetch<'life0, 'async_trait>(
client: &'life0 Client,
tag: &'async_trait str
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
Self: 'async_trait,
Self::Property: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
[src]
client: &'life0 Client,
tag: &'async_trait str
) -> Pin<Box<dyn Future<Output = Result<Player>> + Send + 'async_trait>> where
Self: 'async_trait,
Self::Property: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
(Async) Fetches a player from its tag.
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, Player, traits::*}; let my_client = Client::new("my auth token"); let player = Player::a_fetch(&my_client, "#PLAYERTAGHERE").await?; // now the data for the given player is available for use
impl Serialize for Player
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Player
[src]
impl StructuralPartialEq for Player
[src]
Auto Trait Implementations
impl RefUnwindSafe for Player
impl Send for Player
impl Sync for Player
impl Unpin for Player
impl UnwindSafe for Player
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> PropRouteable for T where
T: GetFetchProp,
[src]
T: GetFetchProp,
type Property = <T as GetFetchProp>::Property
fn get_route(&<T as PropRouteable>::Property) -> Route
[src]
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>,