pub struct AccessToken { /* private fields */ }Expand description
An access token, as a bearer credential.
Debug is redacted. Display is full, because Display here is the
presentation API — a caller putting the token in an Authorization header
is using it the way it was issued — and as_str is the escape hatch for
everything else.
Implementations§
Source§impl AccessToken
impl AccessToken
Sourcepub fn new(value: impl AsRef<str>, expires_in: Option<Duration>) -> Self
pub fn new(value: impl AsRef<str>, expires_in: Option<Duration>) -> Self
A token, optionally with the lifetime the server reported.
Sourcepub const fn expires_in(&self) -> Option<Duration>
pub const fn expires_in(&self) -> Option<Duration>
How long the server said this token lives.
A client is free to cache for exactly this long and no longer. An
absent expires_in is not “never expires” — RFC 6749 §5.1 makes it
RECOMMENDED rather than REQUIRED, so its absence says the server did
not say, and the honest reading is that the client should not cache.
Trait Implementations§
Source§impl Clone for AccessToken
impl Clone for AccessToken
Source§impl Debug for AccessToken
impl Debug for AccessToken
Auto Trait Implementations§
impl Freeze for AccessToken
impl RefUnwindSafe for AccessToken
impl Send for AccessToken
impl Sync for AccessToken
impl Unpin for AccessToken
impl UnsafeUnpin for AccessToken
impl UnwindSafe for AccessToken
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