Router

Trait Router 

Source
pub trait Router<C>:
    Send
    + Sync
    + 'static {
    type Key: Clone + Hash + Eq + Display + Send + Sync;

    // Required method
    fn route(&self, envelope: &Envelope) -> Outcome<Self::Key>;

    // Provided method
    fn update(&self, _config: &C) { ... }
}

Required Associated Types§

Required Methods§

Source

fn route(&self, envelope: &Envelope) -> Outcome<Self::Key>

Provided Methods§

Source

fn update(&self, _config: &C)

Implementations on Foreign Types§

Source§

impl<C> Router<C> for ()

Source§

type Key = Singleton

Source§

fn route(&self, envelope: &Envelope) -> Outcome<Self::Key>

Implementors§

Source§

impl<C, R, K> Router<C> for MapRouter<C, (), (), R>
where C: Send + Sync + 'static, R: Fn(&Envelope) -> Outcome<K> + Send + Sync + 'static, K: Clone + Hash + Eq + Display + Send + Sync,

Source§

type Key = K

Source§

impl<C, S, P, R, K> Router<C> for MapRouter<C, ArcSwap<S>, P, R>
where C: Send + Sync + 'static, S: Send + Sync + 'static, R: Fn(&Envelope, &S) -> Outcome<K> + Send + Sync + 'static, P: Fn(&C, &S) -> S + Send + Sync + 'static, K: Clone + Hash + Eq + Display + Send + Sync,

Source§

type Key = K