Struct CopyToBytes
pub struct CopyToBytes<S> { /* private fields */ }
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.
Implementations
impl<S> CopyToBytes<S>
fn new(inner: S) -> SelfCreates a new
CopyToBytes.fn get_ref(&self) -> &SGets a reference to the underlying sink.
fn get_mut(&mut self) -> &mut SGets a mutable reference to the underlying sink.
fn into_inner(self) -> SConsumes this
CopyToBytes, returning the underlying sink.
Trait Implementations
impl<'__pin, S> Unpin for CopyToBytes<S>
where
PinnedFieldsOf<__Origin<'__pin, S>>: Unpin,
impl<'a, S> Sink<&'a [u8]> for CopyToBytes<S>
where
S: Sink<Bytes>,
type Error = <S as Sink<Bytes>>::Error;fn poll_ready(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn start_send(self: Pin<&mut Self>, item: &'a [u8]) -> Result<(), Self::Error>fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>
impl<S: Debug> Debug for CopyToBytes<S>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<S: Stream> Stream for CopyToBytes<S>
type Item = <S as Stream>::Item;fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>
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> UnsafeUnpin for CopyToBytes<S>
where
S: UnsafeUnpin,
impl<S> UnwindSafe for CopyToBytes<S>
where
S: UnwindSafe,
Blanket Implementations
impl<S, T, E> TryStream for CopyToBytes<S>
where
S: Stream<Item = Result<T, E>> + ?Sized,
type Ok = T;type Error = E;fn try_poll_next(self: Pin<&mut S>, cx: &mut Context<'_>) -> Poll<Option<Result<<S as TryStream>::Ok, <S as TryStream>::Error>>>
impl<T> Any for CopyToBytes<S>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for CopyToBytes<S>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for CopyToBytes<S>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for CopyToBytes<S>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for CopyToBytes<S>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for CopyToBytes<S>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for CopyToBytes<S>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>