Skip to main content

App

Struct App 

Source
pub struct App<W: Write> { /* private fields */ }
Expand description

Main application runtime.

Implementations§

Source§

impl App<Stdout>

Source

pub fn new() -> Result<Self>

Create a new App with stdout.

Source

pub fn with_config(config: AppConfig) -> Result<Self>

Create a new App with custom config.

Source§

impl<W: Write> App<W>

Source

pub fn with_writer(writer: W, config: AppConfig) -> Result<Self>

Create an App with a custom writer.

Source

pub fn exit(&mut self)

Request the app to exit.

Source

pub fn should_exit(&self) -> bool

Check if the app should exit.

Source

pub fn blaeck(&self) -> &Blaeck<W>

Get a reference to the underlying Blaeck renderer.

Source

pub fn blaeck_mut(&mut self) -> &mut Blaeck<W>

Get a mutable reference to the underlying Blaeck renderer.

Source

pub fn run<R, I>(self, render: R, on_input: I) -> Result<AppResult>
where R: FnMut(&mut Self) -> Element, I: FnMut(&mut Self, Key),

Run the app with a render function and input handler.

The render function is called to get the UI element tree. The input handler is called for each key press.

Source

pub fn run_simple<R>(self, render: R) -> Result<AppResult>
where R: FnMut(&mut Self) -> Element,

Run with just a render function (no input handling). Exits on Ctrl+C.

Auto Trait Implementations§

§

impl<W> Freeze for App<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for App<W>
where W: RefUnwindSafe,

§

impl<W> !Send for App<W>

§

impl<W> !Sync for App<W>

§

impl<W> Unpin for App<W>
where W: Unpin,

§

impl<W> UnwindSafe for App<W>
where W: 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.