Struct rspotify::Config

source ·
pub struct Config {
    pub api_base_url: String,
    pub auth_base_url: String,
    pub cache_path: PathBuf,
    pub pagination_chunks: u32,
    pub token_cached: bool,
    pub token_refreshing: bool,
    pub token_callback_fn: Arc<Option<TokenCallback>>,
}
Expand description

Struct to configure the Spotify client.

Fields§

§api_base_url: String

The Spotify API prefix, DEFAULT_API_BASE_URL by default.

§auth_base_url: String

The Spotify Authentication prefix, DEFAULT_AUTH_BASE_URL by default.

§cache_path: PathBuf

The cache file path, in case it’s used. By default it’s DEFAULT_CACHE_PATH

§pagination_chunks: u32

The pagination chunk size used when performing automatically paginated requests, like artist_albums. This means that a request will be performed every pagination_chunks items. By default this is DEFAULT_PAGINATION_CHUNKS.

Note that most endpoints set a maximum to the number of items per request, which most times is 50.

§token_cached: bool

Whether or not to save the authentication token into a JSON file, then reread the token from JSON file when launching the program without following the full auth process again

§token_refreshing: bool

Whether or not to check if the token has expired when sending a request with credentials, and in that case, automatically refresh it.

§token_callback_fn: Arc<Option<TokenCallback>>

Whenever client succeeds to request or refresh a token, the callback function will be invoked

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

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 Config

source§

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

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

impl Default for Config

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl !UnwindSafe for Config

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.