fn worker_for_object(&mut self, object: Object, direction: Direction) -> Option<&WorkerHandle> {
        if self.workers.contains_key(&object) {
            Some(&self.workers[&object])
        } else {
            let chains = match direction {
                Direction::AtoB => self.chains.clone(),
                Direction::BtoA => self.chains.clone().swap(),
            };

            if object.src_chain_id() != &chains.a.id() || object.dst_chain_id() != &chains.b.id() {
                info!(
                    "object {:?} is not relevant to worker for chains {}/{}",
                    object,
                    chains.a.id(),
                    chains.b.id()
                );

                return None;
            }

            let worker = Worker::spawn(chains, object.clone());
            let worker = self.workers.entry(object).or_insert(worker);
            Some(worker)
        }
    }
/// Get a handle to the worker in charge of handling events associated
/// with the given [`Object`].
///
/// This function will spawn a new [`Worker`] if one does not exists already.
///
/// The `direction` parameter indicates in which direction the worker should
/// relay events.
Get a handle to the worker in charge of handling events associated
with the given [`Object`].

This function will spawn a new [`Worker`] if one does not exists already.

The `direction` parameter indicates in which direction the worker should
relay events.
Get a handle to the worker in charge of handling events associated with the given [ ` Object ` ] . This function will spawn a new [ ` Worker ` ] if one does not exists already . The ` direction ` parameter indicates in which direction the worker should relay events .
fn worker_for_object(&mut self, object: Object, direction: Direction) -> Option<&WorkerHandle> {
        if self.workers.contains_key(&object) {
            Some(&self.workers[&object])
        } else {
            let chains = match direction {
                Direction::AtoB => self.chains.clone(),
                Direction::BtoA => self.chains.clone().swap(),
            };
            if object.src_chain_id() != &chains.a.id() || object.dst_chain_id() != &chains.b.id() {
                info!(
                    "object {:?} is not relevant to worker for chains {}/{}",
                    object,
                    chains.a.id(),
                    chains.b.id()
                );
                return None;
            }
            let worker = Worker::spawn(chains, object.clone());
            let worker = self.workers.entry(object).or_insert(worker);
            Some(worker)
        }
    }
fn worker_for_object ( & mut self , object : Object , direction : Direction ) -> Option < & WorkerHandle > { if self . workers . contains_key ( & object ) { Some ( & self . workers [ & object ] ) } else { let chains = match direction { Direction :: AtoB => self . chains . clone ( ) , Direction :: BtoA => self . chains . clone ( ) . swap ( ) , } ; if object . src_chain_id ( ) != & chains . a . id ( ) || object . dst_chain_id ( ) != & chains . b . id ( ) { info ! ( " " object chains a id ( ) chains b id ( ) ) ; return None ; } let worker = Worker :: spawn ( chains , object . clone ( ) ) ; let worker = self . workers . entry ( object ) . or_insert ( worker ) ; Some ( worker ) } }
Get a handle to the worker in charge of handling events associated
with the given [`Object`].
Get a handle to the worker in charge of handling events associated with the given [ ` Object ` ] .
&mut self
object
Object
direction
Direction
&mut self
object
Object
direction
Direction