pub trait Router {
// Required methods
fn get_route(&self, module_id: &ModuleId) -> Option<&dyn Module>;
fn get_route_mut(&mut self, module_id: &ModuleId) -> Option<&mut dyn Module>;
fn has_route(&self, module_id: &ModuleId) -> bool;
fn lookup_module_by_port(&self, port_id: &PortId) -> Option<ModuleId>;
// Provided methods
fn lookup_module_channel(
&self,
msg: &ChannelMsg
) -> Result<ModuleId, ChannelError> { ... }
fn lookup_module_packet(
&self,
msg: &PacketMsg
) -> Result<ModuleId, ChannelError> { ... }
}
Required Methods§
sourcefn get_route(&self, module_id: &ModuleId) -> Option<&dyn Module>
fn get_route(&self, module_id: &ModuleId) -> Option<&dyn Module>
Returns a reference to a Module
registered against the specified ModuleId
sourcefn get_route_mut(&mut self, module_id: &ModuleId) -> Option<&mut dyn Module>
fn get_route_mut(&mut self, module_id: &ModuleId) -> Option<&mut dyn Module>
Returns a mutable reference to a Module
registered against the specified ModuleId
sourcefn has_route(&self, module_id: &ModuleId) -> bool
fn has_route(&self, module_id: &ModuleId) -> bool
Returns true if the Router
has a Module
registered against the specified ModuleId
sourcefn lookup_module_by_port(&self, port_id: &PortId) -> Option<ModuleId>
fn lookup_module_by_port(&self, port_id: &PortId) -> Option<ModuleId>
Return the module_id associated with a given port_id