pub struct BTreeKVRouter<Key, Value, RouteAccepts, Fallback = ()> { /* private fields */ }Expand description
Routes (Key, Value) pairs to acceptors stored in a BTreeMap.
If no route exists for the provided key, the fallback acceptor receives the
original pair. Downstream acceptors also receive the original (Key, Value)
so they can keep using the key.
Implementations§
Source§impl<Key, Value, RouteAccepts> BTreeKVRouter<Key, Value, RouteAccepts, ()>
impl<Key, Value, RouteAccepts> BTreeKVRouter<Key, Value, RouteAccepts, ()>
Source§impl<Key, Value, RouteAccepts, Fallback> BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key, Value, RouteAccepts, Fallback> BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
Sourcepub fn with_fallback(
routes: BTreeMap<Key, RouteAccepts>,
fallback: Fallback,
) -> Self
pub fn with_fallback( routes: BTreeMap<Key, RouteAccepts>, fallback: Fallback, ) -> Self
Creates a BTreeKVRouter with a custom fallback acceptor.
pub fn routes(&self) -> &BTreeMap<Key, RouteAccepts>
pub fn routes_mut(&mut self) -> &mut BTreeMap<Key, RouteAccepts>
pub fn fallback(&self) -> &Fallback
pub fn fallback_mut(&mut self) -> &mut Fallback
Trait Implementations§
Source§impl<Key, Value, RouteAccepts, Fallback> Accepts<(Key, Value)> for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key, Value, RouteAccepts, Fallback> Accepts<(Key, Value)> for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
fn accept(&self, pair: (Key, Value))
Source§impl<Key, Value, RouteAccepts, Fallback> AsyncAccepts<(Key, Value)> for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key, Value, RouteAccepts, Fallback> AsyncAccepts<(Key, Value)> for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
fn accept_async<'a>(
&'a self,
pair: (Key, Value),
) -> impl Future<Output = ()> + 'awhere
Key: 'a,
Value: 'a,
Source§impl<Key: Clone, Value: Clone, RouteAccepts: Clone, Fallback: Clone> Clone for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key: Clone, Value: Clone, RouteAccepts: Clone, Fallback: Clone> Clone for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
Source§fn clone(&self) -> BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
fn clone(&self) -> BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<Key, Value, RouteAccepts, Fallback> Freeze for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>where
Fallback: Freeze,
impl<Key, Value, RouteAccepts, Fallback> RefUnwindSafe for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>where
Fallback: RefUnwindSafe,
Value: RefUnwindSafe,
Key: RefUnwindSafe,
RouteAccepts: RefUnwindSafe,
impl<Key, Value, RouteAccepts, Fallback> Send for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key, Value, RouteAccepts, Fallback> Sync for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key, Value, RouteAccepts, Fallback> Unpin for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
impl<Key, Value, RouteAccepts, Fallback> UnwindSafe for BTreeKVRouter<Key, Value, RouteAccepts, Fallback>
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