[][src]Struct brawl_api::model::clubs::Club

pub struct Club {
    pub tag: String,
    pub name: String,
    pub description: Option<String>,
    pub trophies: usize,
    pub required_trophies: usize,
    pub members: ClubMembers,
    pub club_type: ClubType,
}

A struct representing a Brawl Stars club, with all of its data. Use Club::fetch to fetch one based on tag.

Fields

tag: String

The club's tag. Note: this includes the initial '#'.

name: String

The club's name.

description: Option<String>

The club's description.

trophies: usize

The club's trophies.

required_trophies: usize

The amount of trophies required to enter on this club, or 0 if it allows any amount.

members: ClubMembers

The members in this club, as a vector of ClubMember (note that the ClubMembers struct is simply a smart pointer for Vec<ClubMember>).

club_type: ClubType

The type of club (see ClubType docs).

Trait Implementations

impl Clone for Club[src]

impl Debug for Club[src]

impl Default for Club[src]

fn default() -> Club[src]

Returns an instance of Club with initial values.

Examples

use brawl_api::{Club, ClubType, ClubMembers};

assert_eq!(
    Club::default(),
    Club {
        tag: String::from(""),
        name: String::from(""),
        description: None,
        trophies: 0,
        required_trophies: 0,
        members: ClubMembers::default(),
        club_type: ClubType::Open,
    }
);

impl<'de> Deserialize<'de> for Club[src]

impl Eq for Club[src]

impl FetchFrom<ClubRanking> for Club[src]

fn fetch_from(client: &Client, c_ranking: &ClubRanking) -> Result<Club>[src]

(Sync) Fetches a Club using data from a ClubRanking object.

fn a_fetch_from<'life0, 'life1, 'async_trait>(
    client: &'life0 Client,
    c_ranking: &'life1 ClubRanking
) -> Pin<Box<dyn Future<Output = Result<Club>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait, 
[src]

(Async) Fetches a Club using data from a ClubRanking object.

impl FetchFrom<PlayerClub> for Club[src]

fn fetch_from(client: &Client, p_club: &PlayerClub) -> Result<Club>[src]

(Sync) Fetches a Club using data from a PlayerClub object.

fn a_fetch_from<'life0, 'life1, 'async_trait>(
    client: &'life0 Client,
    p_club: &'life1 PlayerClub
) -> Pin<Box<dyn Future<Output = Result<Club>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait, 
[src]

(Async) Fetches a Club using data from a PlayerClub object.

impl<'_> From<&'_ Club> for ClubMembers[src]

fn from(club: &Club) -> ClubMembers[src]

Simply returns a given Club's members field, while cloning.

impl<'a> From<&'a Club> for &'a ClubMembers[src]

fn from(club: &'a Club) -> Self[src]

Simply returns a given Club's members field.

impl From<Club> for ClubMembers[src]

fn from(club: Club) -> ClubMembers[src]

Simply returns a given Club's members field.

impl GetFetchProp for Club[src]

type Property = str

impl Hash for Club[src]

impl PartialEq<Club> for Club[src]

impl PropFetchable for Club[src]

type Property = str

fn fetch(client: &Client, tag: &str) -> Result<Club>[src]

(Sync) Fetches a club 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

This example is not tested
use brawl_api::{Client, Club, traits::*};

let my_client = Client::new("my auth token");
let club = Club::fetch(&my_client, "#CLUBTAGHERE")?;
// now the data for the given club is available for use.

fn a_fetch<'life0, 'async_trait>(
    client: &'life0 Client,
    tag: &'async_trait str
) -> Pin<Box<dyn Future<Output = Result<Club>> + Send + 'async_trait>> where
    Self: 'async_trait,
    Self::Property: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

(Async) Fetches a club 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

This example is not tested
use brawl_api::{Client, Club, traits::*};

let my_client = Client::new("my auth token");
let club = Club::a_fetch(&my_client, "#CLUBTAGHERE").await?;
// now the data for the given club is available for use.

impl Serialize for Club[src]

impl StructuralEq for Club[src]

impl StructuralPartialEq for Club[src]

Auto Trait Implementations

impl RefUnwindSafe for Club

impl Send for Club

impl Sync for Club

impl Unpin for Club

impl UnwindSafe for Club

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> FetchFrom<T> for T where
    T: Clone + Send + Sync
[src]

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]

(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]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> PropRouteable for T where
    T: GetFetchProp
[src]

type Property = <T as GetFetchProp>::Property

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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.