Struct holochain::prelude::dependencies::kitsune_p2p_types::dependencies::lair_keystore_api::dependencies::tokio::io::Lines
source · pub struct Lines<R> { /* private fields */ }
Expand description
Reads lines from an AsyncBufRead
.
A Lines
can be turned into a Stream
with LinesStream
.
This type is usually created using the lines
method.
Implementations§
source§impl<R> Lines<R>where
R: AsyncBufRead + Unpin,
impl<R> Lines<R>where R: AsyncBufRead + Unpin,
sourcepub async fn next_line(
&mut self
) -> impl Future<Output = Result<Option<String>, Error>>
pub async fn next_line( &mut self ) -> impl Future<Output = Result<Option<String>, Error>>
Returns the next line in the stream.
Cancel safety
This method is cancellation safe.
Examples
use tokio::io::AsyncBufReadExt;
let mut lines = my_buf_read.lines();
while let Some(line) = lines.next_line().await? {
println!("length = {}", line.len())
}
sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Unwraps this Lines<R>
, returning the underlying reader.
Note that any leftover data in the internal buffer is lost. Therefore, a following read from the underlying reader may lead to data loss.
source§impl<R> Lines<R>where
R: AsyncBufRead,
impl<R> Lines<R>where R: AsyncBufRead,
sourcepub fn poll_next_line(
self: Pin<&mut Lines<R>>,
cx: &mut Context<'_>
) -> Poll<Result<Option<String>, Error>>
pub fn poll_next_line( self: Pin<&mut Lines<R>>, cx: &mut Context<'_> ) -> Poll<Result<Option<String>, Error>>
Polls for the next line in the stream.
This method returns:
Poll::Pending
if the next line is not yet available.Poll::Ready(Ok(Some(line)))
if the next line is available.Poll::Ready(Ok(None))
if there are no more lines in this stream.Poll::Ready(Err(err))
if an IO error occurred while reading the next line.
When the method returns Poll::Pending
, the Waker
in the provided
Context
is scheduled to receive a wakeup when more bytes become
available on the underlying IO resource. Note that on multiple calls to
poll_next_line
, only the Waker
from the Context
passed to the most
recent call is scheduled to receive a wakeup.
Trait Implementations§
impl<'__pin, R> Unpin for Lines<R>where __Origin<'__pin, R>: Unpin,
Auto Trait Implementations§
impl<R> RefUnwindSafe for Lines<R>where R: RefUnwindSafe,
impl<R> Send for Lines<R>where R: Send,
impl<R> Sync for Lines<R>where R: Sync,
impl<R> UnwindSafe for Lines<R>where R: UnwindSafe,
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.