Struct NullSocket

Source
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

Source

pub fn new() -> NullSocket

Creates a new instance of NullSocket.

Trait Implementations§

Source§

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>>

A non-blocking, poll_* version of std::net::UdpSocket::recv_from that can optionally provide the destination (local) SocketAddr. Read more
Source§

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

Source§

fn poll_send_to<B>( self: Pin<&Self>, _cx: &mut Context<'_>, buf: &[u8], _addr: B, ) -> Poll<Result<usize, Self::Error>>
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error>,

A non-blocking, poll_* version of std::net::UdpSocket::send_to. Read more
Source§

fn next_send_to<'a, 'b, B>( &'a self, buf: &'b [u8], addr: B, ) -> NextSendToFuture<'a, 'b, Self>
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error>,

Returns a future that uses AsyncSendTo::poll_send_to.
Source§

fn send_to<B>(&self, buf: &[u8], addr: B) -> Result<usize, Self::Error>
where B: ToSocketAddrs<SocketAddr = Self::SocketAddr, Error = Self::Error>,

A synchronous version of AsyncSendTo::poll_send_to. If this isn’t overridden by the trait’s implementation, the default version will call poll_send_to() and panics if it returns Poll::Pending.
Source§

impl DatagramSocketTypes for NullSocket

Source§

type SocketAddr = NullSocketAddr

The “SocketAddr” type used by this “socket”. Typically std::net::SocketAddr.
Source§

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>

Returns the local SocketAddr of this “socket”.
Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl MulticastSocket for NullSocket

Source§

type IpAddr = String

The “address” type for this socket. Read more
Source§

fn join_multicast<A>(&self, _addr: A) -> Result<(), Self::Error>
where A: Into<Self::IpAddr>,

Attempts to join the given multicast group.
Source§

fn leave_multicast<A>(&self, _addr: A) -> Result<(), Self::Error>
where A: Into<Self::IpAddr>,

Attempts to leave the given multicast group.
Source§

impl AsyncDatagramSocket for NullSocket

Source§

impl Unpin for NullSocket

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V