pub struct Random<T>{ /* private fields */ }Expand description
A load balancer that randomly selects an entry.
Implementations§
Source§impl<T> Random<T>
impl<T> Random<T>
Sourcepub async fn update<F, R, N>(&self, handler: F) -> Result<N>
pub async fn update<F, R, N>(&self, handler: F) -> Result<N>
Run an async callback with access to the internal state.
Sourcepub async fn update_timer<F, R>(
&self,
handler: F,
interval: Duration,
) -> Result<JoinHandle<()>>
pub async fn update_timer<F, R>( &self, handler: F, interval: Duration, ) -> Result<JoinHandle<()>>
Spawn a background task that calls handler every interval.
The handler is called once immediately; if that initial call fails the error is returned and no background task is spawned.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Random<T>
impl<T> !UnwindSafe for Random<T>
impl<T> Freeze for Random<T>
impl<T> Send for Random<T>
impl<T> Sync for Random<T>
impl<T> Unpin for Random<T>
impl<T> UnsafeUnpin for Random<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