[−][src]Trait brawl_api::traits::Refetchable
A trait representing a type whose instance can be fetched again.
Note that all types implementing GetFetchProp
and PropFetchable
also implement
Refetchable
due to a blanket implementation.
Required methods
fn refetch(&self, client: &Client) -> Result<Self>
(Sync) Causes this instance to be re-fetched (i.e., updated to latest Brawl Stars data).
Examples
use brawl_api::prelude::*; let my_client = Client::new("my auth key"); let player = Player::fetch(&my_client, "#PLAYER_TAG_HERE")?; // after using it a bit, we want to update its data let player = player.refetch(&my_client)?; // `refetch` does not mutate the instance! // player variable is now up-to-date.
fn a_refetch<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
(Async) Causes this instance to be re-fetched (i.e., updated to latest Brawl Stars data).
Examples
use brawl_api::prelude::*; let my_client = Client::new("my auth key"); let player = Player::a_fetch(&my_client, "#PLAYER_TAG_HERE").await?; // after using it a bit, we want to update its data let player = player.a_refetch(&my_client).await?; // this does not mutate the old instance! // player variable is now up-to-date.
Provided methods
fn refetch_update(&mut self, client: &Client) -> Result<&Self>
(Sync) Like refetch
, but mutates the instance, returning an immutable reference to it.
Its usage and errors are the same (it is called, after all), but the old variable does not need to be assigned; rather, that is done for the programmer (the variable's value is entirely replaced by a new one, if the fetching is successful).
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,
&'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,
(Async) Like a_refetch
, but mutates the instance, returning an immutable reference to it.
Its usage and errors are the same (it is called, after all), but the old variable does not need to be assigned; rather, that is done for the programmer (the variable's value is entirely replaced by a new one, if the fetching is successful).
Implementors
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.
impl<T> Refetchable for T where
T: PropFetchable<Property = <T as GetFetchProp>::Property> + GetFetchProp + Sized + Send + Sync,
<T as GetFetchProp>::Property: Sync + Send,
[src]
T: PropFetchable<Property = <T as GetFetchProp>::Property> + GetFetchProp + Sized + Send + Sync,
<T as GetFetchProp>::Property: Sync + Send,
fn refetch(&self, client: &Client) -> Result<Self>
[src]
fn a_refetch<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
T: 'async_trait,
<T as GetFetchProp>::Property: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>> where
T: 'async_trait,
<T as GetFetchProp>::Property: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,