pub struct LoopbackSocket { /* private fields */ }
Expand description
An instance of AsyncDatagramSocket
that implements a simple loopback interface, where
all packets that are sent are looped back to the input.
Implementations§
Source§impl LoopbackSocket
impl LoopbackSocket
Sourcepub fn new() -> LoopbackSocket
pub fn new() -> LoopbackSocket
Creates a new instance of LoopbackSocket
.
Trait Implementations§
Source§impl AsyncRecvFrom for LoopbackSocket
impl AsyncRecvFrom for LoopbackSocket
Source§fn poll_recv_from(
self: Pin<&Self>,
cx: &mut Context<'_>,
buf: &mut [u8],
) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
fn poll_recv_from( self: Pin<&Self>, cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll<Result<(usize, Self::SocketAddr, Option<Self::SocketAddr>), Self::Error>>
A non-blocking,
poll_*
version of std::net::UdpSocket::recv_from
that can
optionally provide the destination (local) SocketAddr
. Read moreSource§fn next_recv_from<'a, 'b>(
&'a self,
buf: &'b mut [u8],
) -> NextRecvFromFuture<'a, 'b, Self> ⓘ
fn next_recv_from<'a, 'b>( &'a self, buf: &'b mut [u8], ) -> NextRecvFromFuture<'a, 'b, Self> ⓘ
Returns a future that uses
poll_recv_from
.Source§impl AsyncSendTo for LoopbackSocket
impl AsyncSendTo for LoopbackSocket
Source§fn poll_send_to<B>(
self: Pin<&Self>,
cx: &mut Context<'_>,
buf: &[u8],
addr: B,
) -> Poll<Result<usize, Self::Error>>
fn poll_send_to<B>( self: Pin<&Self>, cx: &mut Context<'_>, buf: &[u8], addr: B, ) -> Poll<Result<usize, Self::Error>>
Source§fn next_send_to<'a, 'b, B>(
&'a self,
buf: &'b [u8],
addr: B,
) -> NextSendToFuture<'a, 'b, Self> ⓘ
fn next_send_to<'a, 'b, B>( &'a self, buf: &'b [u8], addr: B, ) -> NextSendToFuture<'a, 'b, Self> ⓘ
Returns a future that uses
AsyncSendTo::poll_send_to
.Source§impl DatagramSocketTypes for LoopbackSocket
impl DatagramSocketTypes for LoopbackSocket
Source§type SocketAddr = LoopbackSocketAddr
type SocketAddr = LoopbackSocketAddr
The “
SocketAddr
” type used by this “socket”. Typically std::net::SocketAddr
.Source§type Error = Error
type Error = Error
The error type for errors emitted from this socket. Typically
std::io::Error
.Source§fn local_addr(&self) -> Result<Self::SocketAddr, Self::Error>
fn local_addr(&self) -> Result<Self::SocketAddr, Self::Error>
Returns the local
SocketAddr
of this “socket”.Source§fn lookup_host(
host: &str,
_port: u16,
) -> Result<IntoIter<Self::SocketAddr>, Self::Error>where
Self: Sized,
fn lookup_host(
host: &str,
_port: u16,
) -> Result<IntoIter<Self::SocketAddr>, Self::Error>where
Self: Sized,
Performs a blocking hostname lookup.
Source§impl Debug for LoopbackSocket
impl Debug for LoopbackSocket
Source§impl MulticastSocket for LoopbackSocket
impl MulticastSocket for LoopbackSocket
impl AsyncDatagramSocket for LoopbackSocket
impl Unpin for LoopbackSocket
Auto Trait Implementations§
impl !Freeze for LoopbackSocket
impl !RefUnwindSafe for LoopbackSocket
impl Send for LoopbackSocket
impl Sync for LoopbackSocket
impl !UnwindSafe for LoopbackSocket
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more