pub trait TokenSource: Send + Sync {
// Required method
fn mint(&self) -> Result<MintedToken>;
// Provided method
fn describe(&self) -> String { ... }
}Expand description
Anything that can produce a bearer token for the client.
Implementors must be Send + Sync because the client caches tokens
behind a mutex and is shared across tasks.
Required Methods§
Sourcefn mint(&self) -> Result<MintedToken>
fn mint(&self) -> Result<MintedToken>
Mint a fresh token. The client calls this lazily and caches the result until shortly before it expires, so this need not be cheap.
Provided Methods§
Trait Implementations§
Source§impl Debug for dyn TokenSource
impl Debug for dyn TokenSource
Source§impl IntoTokenSource for Box<dyn TokenSource>
impl IntoTokenSource for Box<dyn TokenSource>
fn into_token_source(self) -> Box<dyn TokenSource>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".