pub struct Refresher { /* private fields */ }Expand description
One board’s refresh coordinator. A target is a string key; every target coalesces and throttles independently of every other target.
Implementations§
Source§impl Refresher
impl Refresher
Sourcepub fn run(
&self,
key: &str,
now: i64,
fetch: impl FnOnce() -> Result<Value, String>,
) -> Result<Value, String>
pub fn run( &self, key: &str, now: i64, fetch: impl FnOnce() -> Result<Value, String>, ) -> Result<Value, String>
Runs fetch for key at most once per overlapping or throttled
window; fetch must succeed with a JSON object. now is the
Unix-second request time, used for both the cooldown check and the
returned refreshedAt.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Refresher
impl Forget for Refresher
impl Move for Refresher
impl RefUnwindSafe for Refresher
impl Send for Refresher
impl Sync for Refresher
impl Unpin for Refresher
impl UnsafeUnpin for Refresher
impl UnwindSafe for Refresher
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