pub struct NullSocket;
Expand description
An instance of AsyncDatagramSocket
that implements a simple null interface, where
all packets that are sent are discarded.
Implementations§
Source§impl NullSocket
impl NullSocket
Sourcepub fn new() -> NullSocket
pub fn new() -> NullSocket
Creates a new instance of NullSocket
.
Trait Implementations§
Source§impl AsyncRecvFrom for NullSocket
impl AsyncRecvFrom for NullSocket
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 NullSocket
impl AsyncSendTo for NullSocket
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 NullSocket
impl DatagramSocketTypes for NullSocket
Source§type SocketAddr = NullSocketAddr
type SocketAddr = NullSocketAddr
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 NullSocket
impl Debug for NullSocket
Source§impl MulticastSocket for NullSocket
impl MulticastSocket for NullSocket
impl AsyncDatagramSocket for NullSocket
impl Unpin for NullSocket
Auto Trait Implementations§
impl Freeze for NullSocket
impl RefUnwindSafe for NullSocket
impl Send for NullSocket
impl Sync for NullSocket
impl UnwindSafe for NullSocket
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