Skip to main content

Replies

Struct Replies 

Source
pub struct Replies<T> { /* private fields */ }
Expand description

Drops the terminal’s answers from what’s read. A unit is what’s read at once (a key event for the loop, a byte in a test) with the bytes it stands for: Alt+] is ESC ], Ctrl+G is BEL. Units that stand for none, such as clicks, end any answer under way.

Implementations§

Source§

impl<T> Replies<T>

Source

pub fn take(&mut self, unit: T, bytes: Option<&[u8]>) -> Vec<T>

Takes one unit, and gives back those that are input, in order: none while it may still be an answer’s start, and what was held with it once it isn’t.

Source

pub fn release(&mut self) -> Vec<T>

No more input came: what’s held wasn’t an answer’s start after all, and goes on as it was. Not where a wait read the start: the rest of that answer is still to come.

Source

pub fn waiting(&self, now: Instant) -> bool

Whether something is held that, with answers owed, may be an answer’s start, so more is worth waiting a moment for before what’s held is given back.

Source

pub fn holding(&self) -> bool

Whether anything is held, owed or not.

Source

pub fn owe(&mut self, owed: Owed)

Takes what a wait left owing: answers that may still come, and how far into one it read, so the rest of that one is dropped too.

Source

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

The background colour the last answer read whole said, as rgb:…, once.

Trait Implementations§

Source§

impl<T> Default for Replies<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Forget for Replies<T>

§

impl<T> Freeze for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: Freeze,

§

impl<T> Move for Replies<T>

§

impl<T> RefUnwindSafe for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: RefUnwindSafe,

§

impl<T> Send for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: Send,

§

impl<T> Sync for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: Sync,

§

impl<T> Unpin for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: Unpin,

§

impl<T> UnsafeUnpin for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: UnsafeUnpin,

§

impl<T> UnwindSafe for Replies<T>
where Vec<(T, Option<Vec<u8>>)>: UnwindSafe,

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.