Struct tokio_util::io::copy_to_bytes::CopyToBytes
source · pub struct CopyToBytes<S> {
inner: S,
}
Expand description
A helper that wraps a Sink
<
Bytes
>
and converts it into a
Sink
<&'a [u8]>
by copying each byte slice into an owned Bytes
.
See the documentation for SinkWriter
for an example.
Fields§
§inner: S
Implementations§
source§impl<S> CopyToBytes<S>
impl<S> CopyToBytes<S>
sourcepub fn new(inner: S) -> Self
pub fn new(inner: S) -> Self
Creates a new CopyToBytes
.
sourcepub fn into_inner(self) -> S
pub fn into_inner(self) -> S
Consumes this CopyToBytes
, returning the underlying sink.
Trait Implementations§
source§impl<S: Debug> Debug for CopyToBytes<S>
impl<S: Debug> Debug for CopyToBytes<S>
source§impl<'a, S> Sink<&'a [u8]> for CopyToBytes<S>
impl<'a, S> Sink<&'a [u8]> for CopyToBytes<S>
source§type Error = <S as Sink<Bytes>>::Error
type Error = <S as Sink<Bytes>>::Error
The type of value produced by the sink when an error occurs.
source§fn poll_ready(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>>
fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<(), Self::Error>>
Attempts to prepare the
Sink
to receive a value. Read moresource§fn start_send(self: Pin<&mut Self>, item: &'a [u8]) -> Result<(), Self::Error>
fn start_send(self: Pin<&mut Self>, item: &'a [u8]) -> Result<(), Self::Error>
Begin the process of sending a value to the sink.
Each call to this function must be preceded by a successful call to
poll_ready
which returned Poll::Ready(Ok(()))
. Read moresource§impl<S: Stream> Stream for CopyToBytes<S>
impl<S: Stream> Stream for CopyToBytes<S>
impl<'__pin, S> Unpin for CopyToBytes<S>where
PinnedFieldsOf<__Origin<'__pin, S>>: Unpin,
Auto Trait Implementations§
impl<S> Freeze for CopyToBytes<S>where
S: Freeze,
impl<S> RefUnwindSafe for CopyToBytes<S>where
S: RefUnwindSafe,
impl<S> Send for CopyToBytes<S>where
S: Send,
impl<S> Sync for CopyToBytes<S>where
S: Sync,
impl<S> UnwindSafe for CopyToBytes<S>where
S: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more