use futures_core::task::{Context, Poll}; use futures_io::{AsyncWrite, IoSlice}; use std::fmt; use std::io; use std::pin::Pin;
/// Writer for the [`sink()`] function. #[must_use = "writers do nothing unless polled"] pubstruct Sink {
_priv: (),
}
/// Creates an instance of a writer which will successfully consume all data. /// /// All calls to `poll_write` on the returned instance will return `Poll::Ready(Ok(buf.len()))` /// and the contents of the buffer will not be inspected. /// /// # Examples /// /// ```rust /// # futures::executor::block_on(async { /// use futures::io::{self, AsyncWriteExt}; /// /// let buffer = vec![1, 2, 3, 5, 8]; /// let mut writer = io::sink(); /// let num_bytes = writer.write(&buffer).await?; /// assert_eq!(num_bytes, 5); /// # Ok::<(), Box<dyn std::error::Error>>(()) }).unwrap(); /// ``` pubfn sink() -> Sink {
Sink { _priv: () }
}
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.