use std::{
io,
task::{Context, Poll},
};
use crate::{Socket, SocketAddr};
pub trait AsyncSocket: Sized + Unpin {
fn socket_ref(&self) -> &Socket;
fn socket_mut(&mut self) -> &mut Socket;
fn new(protocol: isize) -> io::Result<Self>;
fn poll_send(
&self,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<io::Result<usize>>;
fn poll_send_to(
&self,
cx: &mut Context<'_>,
buf: &[u8],
addr: &SocketAddr,
) -> Poll<io::Result<usize>>;
fn poll_recv<B>(
&self,
cx: &mut Context<'_>,
buf: &mut B,
) -> Poll<io::Result<()>>
where
B: bytes::BufMut;
fn poll_recv_from<B>(
&self,
cx: &mut Context<'_>,
buf: &mut B,
) -> Poll<io::Result<SocketAddr>>
where
B: bytes::BufMut;
fn poll_recv_from_full(
&self,
cx: &mut Context<'_>,
) -> Poll<io::Result<(Vec<u8>, SocketAddr)>>;
}