Skip to main content

Lines

Struct Lines 

Source
pub struct Lines(/* private fields */);
Expand description

The caller’s side of a line queue, which yields each line of the stream without its newline as the run reads it. Dropping it tells the run that nobody reads the lines, and the run reads the rest of the stream and drops it.

Implementations§

Source§

impl Lines

Source

pub fn recv(&self) -> Option<Vec<u8>>

Waits for the next line and returns it, or returns None once the run has ended and every queued line has been returned.

Source

pub fn recv_timeout(&self, timeout: Duration) -> Result<Option<Vec<u8>>, Silent>

Waits at most timeout for the next line, as Lines::recv does.

§Errors

Returns Silent when no line arrived and the run did not end within timeout.

Source

pub fn lost(&self) -> Option<Vec<u8>>

Returns the stream’s last line when a full queue dropped it after the run began to stop, so Lines::recv never returned it. It returns None until the run has ended, and the line only once.

Trait Implementations§

Source§

impl Debug for Lines

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Lines

Source§

fn drop(&mut self)

Tells the run that nobody reads the lines, so its reader stops waiting for room.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl Forget for Lines

§

impl Freeze for Lines

§

impl RefUnwindSafe for Lines

§

impl Send for Lines

§

impl Sync for Lines

§

impl Unpin for Lines

§

impl UnsafeUnpin for Lines

§

impl UnwindSafe for Lines

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.