Struct mesh::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() -> (Port, Port)
pub fn new_pair() -> (Port, Port)
Creates a new bidirectional channel, returning a pair of ports.
sourcepub fn set_handler<T>(self, handler: T) -> PortWithHandler<T>where
T: HandlePortEvent,
pub fn set_handler<T>(self, handler: T) -> PortWithHandler<T>where
T: HandlePortEvent,
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, U> From<Channel<T, U>> for Portwhere
T: MeshPayload,
U: MeshPayload,
impl<T, U> From<Channel<T, U>> for Portwhere
T: MeshPayload,
U: MeshPayload,
source§impl<T> From<OneshotReceiver<T>> for Portwhere
T: MeshField,
impl<T> From<OneshotReceiver<T>> for Portwhere
T: MeshField,
source§fn from(v: OneshotReceiver<T>) -> Port
fn from(v: OneshotReceiver<T>) -> Port
Converts to this type from the input type.
source§impl<T> From<OneshotSender<T>> for Portwhere
T: MeshField,
impl<T> From<OneshotSender<T>> for Portwhere
T: MeshField,
source§fn from(v: OneshotSender<T>) -> Port
fn from(v: OneshotSender<T>) -> Port
Converts to this type from the input type.
source§impl<T> From<Port> for OneshotSender<T>where
T: MeshField,
impl<T> From<Port> for OneshotSender<T>where
T: MeshField,
source§fn from(port: Port) -> OneshotSender<T>
fn from(port: Port) -> OneshotSender<T>
Converts to this type from the input type.
source§impl<T> From<Port> for PortWithHandler<T>where
T: Default + HandlePortEvent,
impl<T> From<Port> for PortWithHandler<T>where
T: Default + HandlePortEvent,
source§fn from(port: Port) -> PortWithHandler<T>
fn from(port: Port) -> PortWithHandler<T>
Converts to this type from the input type.
source§impl<T> From<PortWithHandler<T>> for Portwhere
T: HandlePortEvent,
impl<T> From<PortWithHandler<T>> for Portwhere
T: HandlePortEvent,
source§fn from(port: PortWithHandler<T>) -> Port
fn from(port: PortWithHandler<T>) -> Port
Converts to this type from the input type.
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