[][src]Struct trust_dns_proto::udp::UdpStream

#[must_use = "futures do nothing unless polled"]
pub struct UdpStream<S: Send> { /* fields omitted */ }

A UDP stream of DNS binary packets

Methods

impl<S: UdpSocket + Send + 'static> UdpStream<S>[src]

pub fn new(
    name_server: SocketAddr
) -> (Box<dyn Future<Output = Result<UdpStream<S>, Error>> + Send + Unpin>, BufStreamHandle)
[src]

This method is intended for client connections, see with_bound for a method better for straight listening. It is expected that the resolver wrapper will be responsible for creating and managing new UdpStreams such that each new client would have a random port (reduce chance of cache poisoning). This will return a randomly assigned local port.

Arguments

  • name_server - socket address for the remote server (used to determine IPv4 or IPv6)

Return

a tuple of a Future Stream which will handle sending and receiving messages, and a handle which can be used to send messages into the stream.

pub fn with_bound(socket: S) -> (Self, BufStreamHandle)[src]

Initialize the Stream with an already bound socket. Generally this should be only used for server listening sockets. See new for a client oriented socket. Specifically, this there is already a bound socket in this context, whereas new makes sure to randomize ports for additional cache poison prevention.

Arguments

  • socket - an already bound UDP socket

Return

a tuple of a Future Stream which will handle sending and receiving messsages, and a handle which can be used to send messages into the stream.

Trait Implementations

impl<S: UdpSocket + Send + 'static> Stream for UdpStream<S>[src]

type Item = Result<SerialMessage, Error>

Values yielded by the stream.

Auto Trait Implementations

impl<S> Send for UdpStream<S>

impl<S> Sync for UdpStream<S> where
    S: Sync

impl<S> Unpin for UdpStream<S> where
    S: Unpin

impl<S> !UnwindSafe for UdpStream<S>

impl<S> !RefUnwindSafe for UdpStream<S>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<T> StreamExt for T where
    T: Stream + ?Sized
[src]

impl<S> TryStreamExt for S where
    S: TryStream + ?Sized
[src]

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