[−][src]Struct tokio_uds::UnixDatagramFramed
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.
Methods
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, C: Decoder> Stream for UnixDatagramFramed<A, C>
[src][+]
impl<A: AsRef<Path>, C: Encoder> Sink for UnixDatagramFramed<A, C>
[src][+]
Auto Trait Implementations
impl<A, C> Send for UnixDatagramFramed<A, C> where
A: Send,
C: Send,
A: Send,
C: Send,
impl<A, C> Sync for UnixDatagramFramed<A, C> where
A: Sync,
C: Sync,
A: Sync,
C: Sync,
impl<A, C> Unpin for UnixDatagramFramed<A, C> where
A: Unpin,
C: Unpin,
A: Unpin,
C: Unpin,
impl<A, C> !UnwindSafe for UnixDatagramFramed<A, C>
impl<A, C> !RefUnwindSafe for UnixDatagramFramed<A, C>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> From<T> for T
[src][+]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,