Skip to main content

FilteredLoadBalancer

Trait FilteredLoadBalancer 

Source
pub trait FilteredLoadBalancer<T>:
    Send
    + Sync
    + Clone
    + 'static {
    // Required methods
    fn alloc_filter(
        &self,
        predicate: impl FnMut((usize, &T)) -> bool + Send,
    ) -> impl Future<Output = (usize, T)> + Send;
    fn try_alloc_filter(
        &self,
        predicate: impl FnMut((usize, &T)) -> bool,
    ) -> Option<(usize, T)>;
}
Expand description

A load balancer that supports predicate-based filtering during allocation.

Unlike LoadBalancer, filter methods return (usize, T) so callers can identify the allocated entry (e.g. for error feedback).

Required Methods§

Source

fn alloc_filter( &self, predicate: impl FnMut((usize, &T)) -> bool + Send, ) -> impl Future<Output = (usize, T)> + Send

Asynchronously allocate an entry that satisfies the given predicate.

Source

fn try_alloc_filter( &self, predicate: impl FnMut((usize, &T)) -> bool, ) -> Option<(usize, T)>

Attempt to allocate an entry that satisfies the predicate without awaiting.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> FilteredLoadBalancer<T> for FaultTolerant<T>
where T: Clone + Send + Sync + 'static,

Source§

impl<T> FilteredLoadBalancer<T> for Window<T>
where T: Send + Sync + Clone + 'static,