pub trait PacketReceiver:
Send
+ Sync
+ 'static {
// Required method
fn receive_packet(&self, packet: Packet);
}
Expand description
A trait for handling the arrival of a packet on a zx::Port
.
This trait should be implemented by users who wish to write their own
types which receive asynchronous notifications from a zx::Port
.
Implementors of this trait generally contain a futures::task::AtomicWaker
which
is used to wake up the task which can make progress due to the arrival of
the packet.
PacketReceiver
s should be registered with a Core
using the
register_receiver
method on Core
, Handle
, or Remote
.
Upon registration, users will receive a ReceiverRegistration
which provides key
and port
methods. These methods can be used to wait on
asynchronous signals.
Note that PacketReceiver
s may receive false notifications intended for a
previous receiver, and should handle these gracefully.
Required Methods§
Sourcefn receive_packet(&self, packet: Packet)
fn receive_packet(&self, packet: Packet)
Receive a packet when one arrives.