pub struct Cooldown<T>{ /* private fields */ }Expand description
A load balancer that allocates items based on a cooldown interval. Each entry can only be reused after its interval has elapsed since the last allocation.
Implementations§
Source§impl<T> Cooldown<T>
impl<T> Cooldown<T>
Sourcepub fn new(entries: Vec<(Duration, T)>) -> Self
pub fn new(entries: Vec<(Duration, T)>) -> Self
Create a new Cooldown with a list of (interval, value) pairs.
Each value will only be available after its interval has passed since the last allocation.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Cooldown<T>
impl<T> !UnwindSafe for Cooldown<T>
impl<T> Freeze for Cooldown<T>
impl<T> Send for Cooldown<T>
impl<T> Sync for Cooldown<T>
impl<T> Unpin for Cooldown<T>
impl<T> UnsafeUnpin for Cooldown<T>
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