Struct packet_stream_codec::CodecSink
[−]
[src]
pub struct CodecSink<W, B> { /* fields omitted */ }
This sink consumes pairs of Metadata
and AsRef<[u8]>
s of type B
and
encodes them into the wrapped AsyncWrite
of type W
.
Methods
impl<W, B> CodecSink<W, B>
[src]
pub fn new(writer: W) -> CodecSink<W, B>
[src]
Create a new CodecSink
, wrapping the given writer.
pub fn into_inner(self) -> W
[src]
Consume the CodecSink
to retrieve ownership of the inner writer.
Trait Implementations
impl<W, B> Sink for CodecSink<W, B> where
W: AsyncWrite,
B: AsRef<[u8]>,
[src]
W: AsyncWrite,
B: AsRef<[u8]>,
type SinkItem = (B, Metadata)
The length of the [u8] may not be larger than u32::max_value()
.
Otherwise, start_send
returns an error of kind InvalidInput
.
type SinkError = Error
The type of value produced by the sink when an error occurs.
fn poll_ready(&mut self, cx: &mut Context) -> Result<Async<()>, Self::SinkError>
[src]
Attempts to prepare the Sink
to receive a value. Read more
fn start_send(&mut self, item: Self::SinkItem) -> Result<(), Self::SinkError>
[src]
Begin the process of sending a value to the sink. Each call to this function must be proceeded by a successful call to poll_ready
which returned Ok(Async::Ready(()))
. Read more
fn poll_flush(&mut self, cx: &mut Context) -> Result<Async<()>, Self::SinkError>
[src]
Flush any remaining output from this sink. Read more
fn poll_close(&mut self, cx: &mut Context) -> Result<Async<()>, Self::SinkError>
[src]
Flush any remaining output and close this sink, if necessary. Read more