#[non_exhaustive]pub struct CachedBadge {
pub badge: Badge,
pub fetched_at: Instant,
pub ttl: Duration,
}Expand description
Cached badge entry with metadata.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.badge: BadgeThe cached badge.
fetched_at: InstantWhen the badge was fetched.
ttl: DurationTTL for this entry.
Implementations§
Source§impl CachedBadge
impl CachedBadge
Sourcepub fn should_refresh(&self, threshold: Duration) -> bool
pub fn should_refresh(&self, threshold: Duration) -> bool
Check if the badge should be refreshed soon.
Sourcepub fn remaining_ttl(&self) -> Duration
pub fn remaining_ttl(&self) -> Duration
Get the remaining TTL.
Trait Implementations§
Source§impl Clone for CachedBadge
impl Clone for CachedBadge
Source§fn clone(&self) -> CachedBadge
fn clone(&self) -> CachedBadge
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 CachedBadge
impl RefUnwindSafe for CachedBadge
impl Send for CachedBadge
impl Sync for CachedBadge
impl Unpin for CachedBadge
impl UnsafeUnpin for CachedBadge
impl UnwindSafe for CachedBadge
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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