Struct mesh_node::local_node::Port
source · pub struct Port { /* private fields */ }
Expand description
One half of a bidirectional communication channel.
This is a lower-level construct for sending and receiving binary messages.
Most code should use a higher-level channel returned by
mesh_channel::channel()
, which uses this type internally.
Implementations§
source§impl Port
impl Port
sourcepub fn new_pair() -> (Self, Self)
pub fn new_pair() -> (Self, Self)
Creates a new bidirectional channel, returning a pair of ports.
sourcepub fn set_handler<T: HandlePortEvent>(self, handler: T) -> PortWithHandler<T>
pub fn set_handler<T: HandlePortEvent>(self, handler: T) -> PortWithHandler<T>
Sets the handler for incoming messages.
If there are any queued incoming messages, or if the port has already been closed or failed, then the relevant handler methods will be called directly on this thread.
Trait Implementations§
source§impl DefaultEncoding for Port
impl DefaultEncoding for Port
source§impl<T: Default + HandlePortEvent> From<Port> for PortWithHandler<T>
impl<T: Default + HandlePortEvent> From<Port> for PortWithHandler<T>
source§impl<T: HandlePortEvent> From<PortWithHandler<T>> for Port
impl<T: HandlePortEvent> From<PortWithHandler<T>> for Port
source§fn from(port: PortWithHandler<T>) -> Self
fn from(port: PortWithHandler<T>) -> Self
Converts to this type from the input type.
source§impl TryFrom<Resource> for Port
impl TryFrom<Resource> for Port
source§type Error = ResourceError
type Error = ResourceError
The type returned in the event of a conversion error.
impl Downcast<Port> for Port
Auto Trait Implementations§
impl Freeze for Port
impl !RefUnwindSafe for Port
impl Send for Port
impl Sync for Port
impl Unpin for Port
impl !UnwindSafe for Port
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