Trait Router

Source
pub trait Router:
    Send
    + Sync
    + 'static {
    // Required methods
    fn register(
        &mut self,
        patterns: &[&str],
        index: usize,
    ) -> Result<(), RegisterError>;
    fn route(&self, routing_key: &str) -> Option<usize>;

    // Provided method
    fn finish(&mut self) { ... }
}

Required Methods§

Source

fn register( &mut self, patterns: &[&str], index: usize, ) -> Result<(), RegisterError>

Register a routing key with the given index.

Source

fn route(&self, routing_key: &str) -> Option<usize>

Route the given routing key to an index.

Provided Methods§

Source

fn finish(&mut self)

Finish the registration process. All errors must’ve been reported through register, thus this method should never fail.

Implementors§