pub struct CommandRouter { /* private fields */ }Expand description
指令路由器:device_id → 协议 → Downlink
下行通道按协议注册;设备按 bind_route 绑定到某协议。若设备只有一种可能的
下行协议,也可先绑定路由再下发。
Implementations§
Source§impl CommandRouter
impl CommandRouter
Sourcepub fn register_downlink(&mut self, downlink: Arc<dyn Downlink>)
pub fn register_downlink(&mut self, downlink: Arc<dyn Downlink>)
注册一个下行通道(按其 Downlink::protocol 归类)
Sourcepub fn bind_route(&mut self, device_id: impl Into<String>, protocol: Protocol)
pub fn bind_route(&mut self, device_id: impl Into<String>, protocol: Protocol)
绑定设备到某下行协议
Sourcepub fn route_count(&self) -> usize
pub fn route_count(&self) -> usize
已绑定的设备数
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CommandRouter
impl !UnwindSafe for CommandRouter
impl Forget for CommandRouter
impl Freeze for CommandRouter
impl Move for CommandRouter
impl Send for CommandRouter
impl Sync for CommandRouter
impl Unpin for CommandRouter
impl UnsafeUnpin for CommandRouter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more