Skip to main content

Headless

Struct Headless 

Source
pub struct Headless<A: App> { /* private fields */ }
Expand description

Drives an App the way the event loop does, minus the terminal.

Implementations§

Source§

impl<A: App> Headless<A>
where A::Message: Send + 'static,

Source

pub fn start(app: A, size: CellSize) -> Self

Start app on a screen of size cells.

Source

pub fn type_bytes(&mut self, bytes: &[u8])

Feed bytes as if typed, with a lone escape counting as Esc.

Source

pub fn input(&mut self, event: InputEvent)

Deliver one input event; answers to pacing queries stay with the loop, as they do on a terminal.

Source

pub fn deliver_messages(&mut self)

Deliver every message the app’s threads queued so far.

Source

pub fn resize(&mut self, size: CellSize)

Resize the screen and let it settle, the way a window resize ends.

Source

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

Draw one frame when the app asked for one; None when it waits or quit.

Source

pub fn quit(&self) -> bool

Whether the app asked to quit.

Source

pub fn app(&self) -> &A

The app, for asserting on its state.

Trait Implementations§

Source§

impl<A: Debug + App> Debug for Headless<A>
where A::Message: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<A> !Sync for Headless<A>

§

impl<A> Forget for Headless<A>

§

impl<A> Freeze for Headless<A>
where A: Freeze, Receiver<Signal<<A as App>::Message>>: Freeze,

§

impl<A> Move for Headless<A>

§

impl<A> RefUnwindSafe for Headless<A>

§

impl<A> Send for Headless<A>
where A: Send, Receiver<Signal<<A as App>::Message>>: Send,

§

impl<A> Unpin for Headless<A>
where A: Unpin, Receiver<Signal<<A as App>::Message>>: Unpin,

§

impl<A> UnsafeUnpin for Headless<A>

§

impl<A> UnwindSafe for Headless<A>

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.