usecrate::stream::{Fuse, StreamExt, TryStreamExt}; use core::fmt; use core::pin::Pin; use futures_core::future::Future; use futures_core::ready; use futures_core::stream::{Stream, TryStream}; use futures_core::task::{Context, Poll}; use futures_sink::Sink;
/// Future for the [`send_all`](super::SinkExt::send_all) method. #[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993 #[must_use = "futures do nothing unless you `.await` or poll them"] pubstruct SendAll<'a, Si, St> where
Si: ?Sized,
St: ?Sized + TryStream,
{
sink: &'a mut Si,
stream: Fuse<&'a mut St>,
buffered: Option<St::Ok>,
}
fn poll(mutself: Pin<&mutSelf>, cx: &mut Context<'_>) -> Poll<Self::Output> { let this = &mut *self; // If we've got an item buffered already, we need to write it to the // sink before we can do anything else iflet Some(item) = this.buffered.take() {
ready!(this.try_start_send(cx, item))?
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.