Trait IsReady

Source
pub trait IsReady {
    // Required methods
    fn queue(&self) -> &SegQueue<GnsConnectionEvent>;
    fn receive<const K: usize>(
        &self,
        messages: &mut [GnsNetworkMessage<ToReceive>; K],
    ) -> usize;
}
Expand description

Common functions available for any GnsSocket state that is implementing it. Regardless of being a client or server, a ready socket will allow us to query for connection events as well as receive messages.

Required Methods§

Source

fn queue(&self) -> &SegQueue<GnsConnectionEvent>

Return a reference to the connection event queue. The queue is thread-safe.

Source

fn receive<const K: usize>( &self, messages: &mut [GnsNetworkMessage<ToReceive>; K], ) -> usize

Poll for incoming messages. K represent the maximum number of messages we are willing to receive. Return the actual number of messsages that has been received.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§