Skip to main content

SocketPacketReading

Trait SocketPacketReading 

Source
pub trait SocketPacketReading: SocketOperation + BufferPooling {
    // Required methods
    fn socket_packet_reader<'scheduler>(
        &'scheduler self,
        socket: &Self::Socket,
    ) -> Result<impl SocketPacketReader<Message: SocketRecvMessageMut<Payload = <Self::Pool as BufferPool>::Buffer>> + 'scheduler + use<'scheduler, Self>>
       where Self: Sized,
             Self::Socket: 'static;
    fn socket_packet_reader_with_pool<'scheduler>(
        &'scheduler self,
        socket: &Self::Socket,
        pool: Self::Pool,
    ) -> Result<impl SocketPacketReader<Message: SocketRecvMessageMut<Payload = <Self::Pool as BufferPool>::Buffer>> + 'scheduler + use<'scheduler, Self>>
       where Self: Sized,
             Self::Socket: 'static;
}
Expand description

Construct sequential packet input bound to this scheduler. Backends choose the static reader and completed message representation without exposing their receive mechanism.

The returned handle may borrow the scheduler, but never the temporary socket reference. It retains backend access independently, so the socket and handle can move together. Retire and drop handles before exclusively closing the socket.

Required Methods§

Source

fn socket_packet_reader<'scheduler>( &'scheduler self, socket: &Self::Socket, ) -> Result<impl SocketPacketReader<Message: SocketRecvMessageMut<Payload = <Self::Pool as BufferPool>::Buffer>> + 'scheduler + use<'scheduler, Self>>
where Self: Sized, Self::Socket: 'static,

Retain the socket and reusable backend state without submitting a receive or allocating a payload pool. Owned reads initialize default storage lazily.

Source

fn socket_packet_reader_with_pool<'scheduler>( &'scheduler self, socket: &Self::Socket, pool: Self::Pool, ) -> Result<impl SocketPacketReader<Message: SocketRecvMessageMut<Payload = <Self::Pool as BufferPool>::Buffer>> + 'scheduler + use<'scheduler, Self>>
where Self: Sized, Self::Socket: 'static,

Construct a reader using the supplied pool for owned messages. Borrowed reads do not acquire pool storage; completed messages retain their pool independently.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§