pub struct Split<R> { /* private fields */ }展开描述
split 方法使用的分割器。
Split 可以通过 SplitStream 转换为 Stream。
实现§
Source§impl<R> Split<R>where
R: AsyncBufRead + Unpin,
impl<R> Split<R>where
R: AsyncBufRead + Unpin,
Source§impl<R> Split<R>where
R: AsyncBufRead,
impl<R> Split<R>where
R: AsyncBufRead,
Sourcepub fn poll_next_segment(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<Option<Vec<u8>>>>
pub fn poll_next_segment( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Option<Vec<u8>>>>
轮询流中的下一段。
此方法返回:
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.
当方法返回 Poll::Pending 时,传入的 Context 中的 Waker 会被调度,
以便在底层 I/O 资源上有更多字节可用时收到唤醒通知。
请注意,对 poll_next_segment 的多次调用中,
只有最近一次调用传入的 Context 中的 Waker 会被调度接收唤醒。
Trait 实现§
impl<'__pin, R> Unpin for Split<R>where
PinnedFieldsOf<__Origin<'__pin, R>>: Unpin,
自动 Trait 实现§
impl<R> Freeze for Split<R>where
R: Freeze,
impl<R> RefUnwindSafe for Split<R>where
R: RefUnwindSafe,
impl<R> Send for Split<R>where
R: Send,
impl<R> Sync for Split<R>where
R: Sync,
impl<R> UnsafeUnpin for Split<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for Split<R>where
R: UnwindSafe,
Blanket 实现§
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. 更多信息