pub struct DataRefreshManager { /* private fields */ }Expand description
Manages periodic data refresh for data sources.
Implementations§
Source§impl DataRefreshManager
impl DataRefreshManager
Sourcepub const fn new() -> DataRefreshManager
pub const fn new() -> DataRefreshManager
Create a new refresh manager.
Sourcepub fn register(&mut self, key: impl Into<String>, interval_ms: u64)
pub fn register(&mut self, key: impl Into<String>, interval_ms: u64)
Register a data source for periodic refresh.
§Arguments
key- Data source identifierinterval_ms- Refresh interval in milliseconds
Sourcepub fn unregister(&mut self, key: &str)
pub fn unregister(&mut self, key: &str)
Unregister a data source.
Sourcepub fn update(&mut self, current_time_ms: u64) -> Vec<String>
pub fn update(&mut self, current_time_ms: u64) -> Vec<String>
Update the manager with the current timestamp.
Returns keys of data sources that need to be refreshed.
Sourcepub fn force_refresh(&mut self, key: &str) -> bool
pub fn force_refresh(&mut self, key: &str) -> bool
Force immediate refresh of a data source.
Sourcepub fn tasks(&self) -> &[RefreshTask]
pub fn tasks(&self) -> &[RefreshTask]
Get all registered tasks.
Sourcepub fn get_task(&self, key: &str) -> Option<&RefreshTask>
pub fn get_task(&self, key: &str) -> Option<&RefreshTask>
Get task by key.
Sourcepub fn time_until_refresh(&self, key: &str) -> Option<u64>
pub fn time_until_refresh(&self, key: &str) -> Option<u64>
Get time until next refresh for a data source (in ms).
Trait Implementations§
Source§impl Debug for DataRefreshManager
impl Debug for DataRefreshManager
Source§impl Default for DataRefreshManager
impl Default for DataRefreshManager
Source§fn default() -> DataRefreshManager
fn default() -> DataRefreshManager
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DataRefreshManager
impl RefUnwindSafe for DataRefreshManager
impl Send for DataRefreshManager
impl Sync for DataRefreshManager
impl Unpin for DataRefreshManager
impl UnwindSafe for DataRefreshManager
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().