Struct ReaderStream
pub struct ReaderStream<R> { /* private fields */ }
Convert an AsyncRead into a Stream of byte chunks.
This stream is fused. It performs the inverse operation of
StreamReader.
Example
#
# async
Implementations
impl<R: AsyncRead> ReaderStream<R>
fn new(reader: R) -> SelfConvert an
AsyncReadinto aStreamwith item typeResult<Bytes, std::io::Error>.Currently, the default capacity 4096 bytes (4 KiB). This capacity is not part of the semver contract and may be tweaked in future releases without requiring a major version bump.
fn with_capacity(reader: R, capacity: usize) -> SelfConvert an
AsyncReadinto aStreamwith item typeResult<Bytes, std::io::Error>, with a specific read buffer initial capacity.
Trait Implementations
impl<'__pin, R> Unpin for ReaderStream<R>
where
PinnedFieldsOf<__Origin<'__pin, R>>: Unpin,
impl<R: AsyncRead> Stream for ReaderStream<R>
type Item = Result<Bytes, Error>;fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>
impl<R: Debug> Debug for ReaderStream<R>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<R> Freeze for ReaderStream<R>
where
Option<R>: Freeze,
impl<R> RefUnwindSafe for ReaderStream<R>
where
Option<R>: RefUnwindSafe,
impl<R> Send for ReaderStream<R>
where
Option<R>: Send,
impl<R> Sync for ReaderStream<R>
where
Option<R>: Sync,
impl<R> UnsafeUnpin for ReaderStream<R>
where
Option<R>: UnsafeUnpin,
impl<R> UnwindSafe for ReaderStream<R>
where
Option<R>: UnwindSafe,
Blanket Implementations
impl<S, T, E> TryStream for ReaderStream<R>
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 ReaderStream<R>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ReaderStream<R>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ReaderStream<R>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for ReaderStream<R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for ReaderStream<R>
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 ReaderStream<R>
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 ReaderStream<R>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>