ibc_core_router/router.rs
1//! Defines the `Router`, which binds modules to ports
2
3use ibc_core_host_types::identifiers::PortId;
4use ibc_core_router_types::module::ModuleId;
5
6use crate::module::Module;
7
8/// Router as defined in ICS-26, which binds modules to ports.
9pub trait Router {
10 /// Returns a reference to a `Module` registered against the specified `ModuleId`
11 fn get_route(&self, module_id: &ModuleId) -> Option<&dyn Module>;
12
13 /// Returns a mutable reference to a `Module` registered against the specified `ModuleId`
14 fn get_route_mut(&mut self, module_id: &ModuleId) -> Option<&mut dyn Module>;
15
16 /// Return the module_id associated with a given port_id
17 fn lookup_module(&self, port_id: &PortId) -> Option<ModuleId>;
18}