use pin_project_lite::pin_project; use std::future::Future; use std::io; use std::marker::PhantomPinned; use std::mem; use std::pin::Pin; use std::string::FromUtf8Error; use std::task::{Context, Poll};
pin_project! { /// Future for the [`read_line`](crate::io::AsyncBufReadExt::read_line) method. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] pubstruct ReadLine<'a, R: ?Sized> {
reader: &'a mut R, // This is the buffer we were provided. It will be replaced with an empty string // while reading to postpone utf-8 handling until after reading.
output: &'a mut String, // The actual allocation of the string is moved into this vector instead.
buf: Vec<u8>, // The number of bytes appended to buf. This can be less than buf.len() if // the buffer was not empty when the operation was started.
read: usize, // Make this future `!Unpin` for compatibility with async trait methods. #[pin]
_pin: PhantomPinned,
}
}
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.