pub struct LocalValue<T> { /* private fields */ }Expand description
Wrapper around a value in memory, used for metrics. We need to use a mutex to keep track of when the value was last updated.
Implementations§
Source§impl<T> LocalValue<T>where
T: Clone + IntoVariant,
impl<T> LocalValue<T>where
T: Clone + IntoVariant,
Sourcepub fn new(value: T) -> LocalValue<T>
pub fn new(value: T) -> LocalValue<T>
Create a new LocalValue with the given value.
Sourcepub fn get_with_time(&self) -> (T, DateTime)
pub fn get_with_time(&self) -> (T, DateTime)
Get the current value and timestamp.
Trait Implementations§
Source§impl<T> Default for LocalValue<T>where
T: Default,
impl<T> Default for LocalValue<T>where
T: Default,
Source§fn default() -> LocalValue<T>
fn default() -> LocalValue<T>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<T> !Freeze for LocalValue<T>
impl<T> !RefUnwindSafe for LocalValue<T>
impl<T> Send for LocalValue<T>where
T: Send,
impl<T> Sync for LocalValue<T>where
T: Send,
impl<T> Unpin for LocalValue<T>where
T: Unpin,
impl<T> UnsafeUnpin for LocalValue<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for LocalValue<T>where
T: UnwindSafe,
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