[][src]Struct tokio_uds::UnixDatagramFramed

#[must_use = "sinks do nothing unless polled"]pub struct UnixDatagramFramed<A, C> { /* fields omitted */ }

A unified Stream and Sink interface to an underlying UnixDatagram, using the Encoder and Decoder traits to encode and decode frames.

Unix datagram sockets work with datagrams, but higher-level code may wants to batch these into meaningful chunks, called "frames". This method layers framing on top of this socket by using the Encoder and Decoder traits to handle encoding and decoding of messages frames. Note that the incoming and outgoing frame types may be distinct.

This function returns a single object that is both Stream and Sink; grouping this into a single object is often useful for layering things which require both read and write access to the underlying object.

If you want to work more directly with the streams and sink, consider calling split on the UnixDatagramFramed returned by this method, which will break them into separate objects, allowing them to interact more easily.

Implementations

impl<A, C> UnixDatagramFramed<A, C>[src]

pub fn new(socket: UnixDatagram, codec: C) -> UnixDatagramFramed<A, C>[src]

Create a new UnixDatagramFramed backed by the given socket and codec.

See struct level documentation for more details.

pub fn get_ref(&self) -> &UnixDatagram[src]

Returns a reference to the underlying I/O stream wrapped by Framed.

Note

Care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

pub fn get_mut(&mut self) -> &mut UnixDatagram[src]

Returns a mutable reference to the underlying I/O stream wrapped by Framed.

Note

Care should be taken to not tamper with the underlying stream of data coming in as it may corrupt the stream of frames otherwise being worked with.

Trait Implementations

impl<A: Debug, C: Debug> Debug for UnixDatagramFramed<A, C>[src]

impl<A: AsRef<Path>, C: Encoder> Sink for UnixDatagramFramed<A, C>[src]

type SinkItem = (C::Item, A)

The type of value that the sink accepts.

type SinkError = C::Error

The type of value produced by the sink when an error occurs.

impl<A, C: Decoder> Stream for UnixDatagramFramed<A, C>[src]

type Item = (C::Item, SocketAddr)

The type of item this stream will yield on success.

type Error = C::Error

The type of error this stream may generate.

Auto Trait Implementations

impl<A, C> !RefUnwindSafe for UnixDatagramFramed<A, C>

impl<A, C> Send for UnixDatagramFramed<A, C> where
    A: Send,
    C: Send

impl<A, C> Sync for UnixDatagramFramed<A, C> where
    A: Sync,
    C: Sync

impl<A, C> Unpin for UnixDatagramFramed<A, C> where
    A: Unpin,
    C: Unpin

impl<A, C> !UnwindSafe for UnixDatagramFramed<A, C>

Blanket Implementations

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

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

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

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

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.