pub struct BearerAuth {
pub token: String,
pub refresh_fn: Option<Box<dyn Fn() -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send>> + Send + Sync>>,
}Expand description
Bearer token authentication
Fields§
§token: String§refresh_fn: Option<Box<dyn Fn() -> Pin<Box<dyn Future<Output = Result<String, AuthError>> + Send>> + Send + Sync>>Implementations§
Source§impl BearerAuth
impl BearerAuth
pub fn new(token: String) -> BearerAuth
pub fn with_auto_refresh<F, Fut>(self, refresh_fn: F) -> BearerAuth
pub fn get_token(&self) -> &str
pub async fn refresh_token(&self) -> Result<String, AuthError>
Trait Implementations§
Source§impl Clone for BearerAuth
impl Clone for BearerAuth
Source§fn clone(&self) -> BearerAuth
fn clone(&self) -> BearerAuth
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BearerAuth
impl !RefUnwindSafe for BearerAuth
impl Send for BearerAuth
impl Sync for BearerAuth
impl Unpin for BearerAuth
impl !UnwindSafe for BearerAuth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more