pub struct CredentialLifetime { /* private fields */ }Expand description
Bounded OAuth-style lifetime derived from expires_in and caller time.
Expiry is exclusive: a credential is expired when now >= expires_at.
The provider duration is never interpreted as provider wall-clock time.
Implementations§
Source§impl CredentialLifetime
impl CredentialLifetime
Sourcepub fn from_expires_in(
observed_at: CredentialTimestamp,
expires_in: u32,
refresh_before: u32,
) -> Result<Self, CredentialLifetimeError>
pub fn from_expires_in( observed_at: CredentialTimestamp, expires_in: u32, refresh_before: u32, ) -> Result<Self, CredentialLifetimeError>
Converts a provider expires_in duration through explicit caller time.
Sourcepub const fn observed_at(self) -> CredentialTimestamp
pub const fn observed_at(self) -> CredentialTimestamp
Returns when the provider duration was observed.
Sourcepub const fn refresh_at(self) -> CredentialTimestamp
pub const fn refresh_at(self) -> CredentialTimestamp
Returns the first timestamp at which refresh is required.
Sourcepub const fn expires_at(self) -> CredentialTimestamp
pub const fn expires_at(self) -> CredentialTimestamp
Returns the exclusive expiry timestamp.
Sourcepub const fn expires_in(self) -> u32
pub const fn expires_in(self) -> u32
Returns the admitted provider duration.
Sourcepub const fn refresh_before(self) -> u32
pub const fn refresh_before(self) -> u32
Returns the caller-selected refresh lead time.
Sourcepub const fn state_at(self, now: CredentialTimestamp) -> CredentialLifetimeState
pub const fn state_at(self, now: CredentialTimestamp) -> CredentialLifetimeState
Classifies the lifetime at one observation from the same caller clock.
Trait Implementations§
Source§impl Clone for CredentialLifetime
impl Clone for CredentialLifetime
Source§fn clone(&self) -> CredentialLifetime
fn clone(&self) -> CredentialLifetime
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for CredentialLifetime
Source§impl Debug for CredentialLifetime
impl Debug for CredentialLifetime
impl Eq for CredentialLifetime
Source§impl Hash for CredentialLifetime
impl Hash for CredentialLifetime
Source§impl Ord for CredentialLifetime
impl Ord for CredentialLifetime
Source§fn cmp(&self, other: &CredentialLifetime) -> Ordering
fn cmp(&self, other: &CredentialLifetime) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for CredentialLifetime
impl PartialEq for CredentialLifetime
Source§impl PartialOrd for CredentialLifetime
impl PartialOrd for CredentialLifetime
impl StructuralPartialEq for CredentialLifetime
Auto Trait Implementations§
impl Freeze for CredentialLifetime
impl RefUnwindSafe for CredentialLifetime
impl Send for CredentialLifetime
impl Sync for CredentialLifetime
impl Unpin for CredentialLifetime
impl UnsafeUnpin for CredentialLifetime
impl UnwindSafe for CredentialLifetime
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