Struct body_image_futio::UniBodySink
source · pub struct UniBodySink { /* private fields */ }
Expand description
Adaptor for BodySink
implementing the futures::Sink
trait. This
allows a Stream<Item=UniBodyBuf>
to be forwarded (e.g. via
futures::Stream::forward
) to a BodySink
, in a fully asynchronous
fashion and with zero-copy MemMap
support (mmap feature only).
Tunables
are used during the streaming to decide when to write back a
BodySink in Ram
to FsWrite
. This implementation uses
tokio_threadpool::blocking
to request becoming a backup thread for
blocking operations including BodySink::write_back
and
BodySink::write_all
(state FsWrite
). It may thus only be used on the
tokio threadpool. If the max_blocking
number of backup threads is
reached, and a blocking operation is required, then this implementation
will appear full, with start_send
returning
Ok(AsyncSink::NotReady(chunk)
, until a backup thread becomes available
or any timeout occurs.
Implementations§
source§impl UniBodySink
impl UniBodySink
sourcepub fn new(body: BodySink, tune: Tunables) -> UniBodySink
pub fn new(body: BodySink, tune: Tunables) -> UniBodySink
Wrap by consuming a BodySink
and Tunables
instances.
Note: Both BodyImage
and Tunables
are Clone
(inexpensive), so
that can be done beforehand to preserve owned copies.
sourcepub fn into_inner(self) -> BodySink
pub fn into_inner(self) -> BodySink
Unwrap and return the BodySink
.
Trait Implementations§
source§impl Debug for UniBodySink
impl Debug for UniBodySink
source§impl Sink for UniBodySink
impl Sink for UniBodySink
§type SinkItem = UniBodyBuf
type SinkItem = UniBodyBuf
source§fn start_send(&mut self, buf: UniBodyBuf) -> StartSend<UniBodyBuf, Flare>
fn start_send(&mut self, buf: UniBodyBuf) -> StartSend<UniBodyBuf, Flare>
source§fn poll_complete(&mut self) -> Poll<(), Flare>
fn poll_complete(&mut self) -> Poll<(), Flare>
source§fn close(&mut self) -> Poll<(), Flare>
fn close(&mut self) -> Poll<(), Flare>
source§fn wait(self) -> Wait<Self>where
Self: Sized,
fn wait(self) -> Wait<Self>where
Self: Sized,
source§fn with<U, F, Fut>(self, f: F) -> With<Self, U, F, Fut>where
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
<Fut as IntoFuture>::Error: From<Self::SinkError>,
Self: Sized,
fn with<U, F, Fut>(self, f: F) -> With<Self, U, F, Fut>where
F: FnMut(U) -> Fut,
Fut: IntoFuture<Item = Self::SinkItem>,
<Fut as IntoFuture>::Error: From<Self::SinkError>,
Self: Sized,
source§fn with_flat_map<U, F, St>(self, f: F) -> WithFlatMap<Self, U, F, St>where
F: FnMut(U) -> St,
St: Stream<Item = Self::SinkItem, Error = Self::SinkError>,
Self: Sized,
fn with_flat_map<U, F, St>(self, f: F) -> WithFlatMap<Self, U, F, St>where
F: FnMut(U) -> St,
St: Stream<Item = Self::SinkItem, Error = Self::SinkError>,
Self: Sized,
source§fn sink_map_err<F, E>(self, f: F) -> SinkMapErr<Self, F>where
F: FnOnce(Self::SinkError) -> E,
Self: Sized,
fn sink_map_err<F, E>(self, f: F) -> SinkMapErr<Self, F>where
F: FnOnce(Self::SinkError) -> E,
Self: Sized,
source§fn sink_from_err<E>(self) -> SinkFromErr<Self, E>where
E: From<Self::SinkError>,
Self: Sized,
fn sink_from_err<E>(self) -> SinkFromErr<Self, E>where
E: From<Self::SinkError>,
Self: Sized,
From
for this sink’s
Error
, returning a new sink. Read more