pub struct Hub { /* private fields */ }Available on crate feature
hub only.Expand description
Implementations§
Source§impl Hub
impl Hub
Sourcepub fn port(&self) -> Port
pub fn port(&self) -> Port
Attach a new port. Frames it sends go to every other port.
The port only receives frames sent after it was created. Dropping the port detaches it.
use rolcb::hub::Hub;
let hub = Hub::new();
let a = hub.port();
let mut b = hub.port();
let frame = rolcb::gridconnect::parse(":X10700285N;").unwrap();
a.send(frame);
assert_eq!(b.recv().await, Some(frame));Sourcepub fn port_count(&self) -> usize
pub fn port_count(&self) -> usize
Number of ports currently attached (including ones created with
Hub::port by the application). Falls as ports are dropped.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Hub
impl RefUnwindSafe for Hub
impl Send for Hub
impl Sync for Hub
impl Unpin for Hub
impl UnsafeUnpin for Hub
impl UnwindSafe for Hub
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