netlink_proto::sys

Trait AsyncSocket

Source
pub trait AsyncSocket: Sized + Unpin {
    // Required methods
    fn socket_ref(&self) -> &Socket;
    fn socket_mut(&mut self) -> &mut Socket;
    fn new(protocol: isize) -> Result<Self, Error>;
    fn poll_send(
        &mut self,
        cx: &mut Context<'_>,
        buf: &[u8],
    ) -> Poll<Result<usize, Error>>;
    fn poll_send_to(
        &mut self,
        cx: &mut Context<'_>,
        buf: &[u8],
        addr: &SocketAddr,
    ) -> Poll<Result<usize, Error>>;
    fn poll_recv<B>(
        &mut self,
        cx: &mut Context<'_>,
        buf: &mut B,
    ) -> Poll<Result<(), Error>>
       where B: BufMut;
    fn poll_recv_from<B>(
        &mut self,
        cx: &mut Context<'_>,
        buf: &mut B,
    ) -> Poll<Result<SocketAddr, Error>>
       where B: BufMut;
    fn poll_recv_from_full(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Result<(Vec<u8>, SocketAddr), Error>>;
}
Expand description

Trait to support different async backends

Required Methods§

Source

fn socket_ref(&self) -> &Socket

Access underyling Socket

Source

fn socket_mut(&mut self) -> &mut Socket

Mutable access to underyling Socket

Source

fn new(protocol: isize) -> Result<Self, Error>

Wrapper for Socket::new

Source

fn poll_send( &mut self, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize, Error>>

Polling wrapper for Socket::send

Source

fn poll_send_to( &mut self, cx: &mut Context<'_>, buf: &[u8], addr: &SocketAddr, ) -> Poll<Result<usize, Error>>

Polling wrapper for Socket::send_to

Source

fn poll_recv<B>( &mut self, cx: &mut Context<'_>, buf: &mut B, ) -> Poll<Result<(), Error>>
where B: BufMut,

Polling wrapper for Socket::recv

Passes 0 for flags, and ignores the returned length (the buffer will have advanced by the amount read).

Source

fn poll_recv_from<B>( &mut self, cx: &mut Context<'_>, buf: &mut B, ) -> Poll<Result<SocketAddr, Error>>
where B: BufMut,

Polling wrapper for Socket::recv_from

Passes 0 for flags, and ignores the returned length - just returns the address (the buffer will have advanced by the amount read).

Source

fn poll_recv_from_full( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(Vec<u8>, SocketAddr), Error>>

Polling wrapper for Socket::recv_from_full

Passes 0 for flags, and ignores the returned length - just returns the address (the buffer will have advanced by the amount read).

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§