Struct Split
struct Split<R> { ... }
Splitter for the split method.
A Split can be turned into a Stream with SplitStream.
Implementations
impl<R> Split<R>
async fn next_segment(self: &mut Self) -> Result<Option<Vec<u8>>>Returns the next segment in the stream.
Examples
# use AsyncBufRead; use AsyncBufReadExt; # async
impl<R> Split<R>
fn poll_next_segment(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<Option<Vec<u8>>>>Polls for the next segment in the stream.
This method returns:
Poll::Pendingif the next segment is not yet available.Poll::Ready(Ok(Some(segment)))if the next segment is available.Poll::Ready(Ok(None))if there are no more segments in this stream.Poll::Ready(Err(err))if an IO error occurred while reading the next segment.
When the method returns
Poll::Pending, theWakerin the providedContextis scheduled to receive a wakeup when more bytes become available on the underlying IO resource.Note that on multiple calls to
poll_next_segment, only theWakerfrom theContextpassed to the most recent call is scheduled to receive a wakeup.
impl<'__pin, R> Unpin for Split<R>
impl<R> Freeze for Split<R>
impl<R> RefUnwindSafe for Split<R>
impl<R> Send for Split<R>
impl<R> Sync for Split<R>
impl<R> UnsafeUnpin for Split<R>
impl<R> UnwindSafe for Split<R>
impl<R: $crate::fmt::Debug> Debug for Split<R>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Any for Split<R>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Split<R>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Split<R>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Split<R>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for Split<R>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Split<R>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Split<R>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>