Skip to main content

App

Trait App 

Source
pub trait App: Sized {
    type Msg: Send + 'static;
    type Panel: Panel;

Show 13 methods // Required methods fn commands(&self) -> Vec<CommandInfo>; fn run(&mut self, line: &str, ctx: &mut Ctx<'_, Self>); // Provided methods fn launch(&mut self, ctx: &mut Ctx<'_, Self>) { ... } fn done(&mut self, msg: Self::Msg, ctx: &mut Ctx<'_, Self>) { ... } fn panel_event( &mut self, event: <Self::Panel as Panel>::Event, ctx: &mut Ctx<'_, Self>, ) { ... } fn tick(&mut self, ctx: &mut Ctx<'_, Self>) { ... } fn refresh(&mut self) { ... } fn header(&self) -> Vec<Row> ⓘ { ... } fn notices(&self) -> Vec<Notice> { ... } fn footer(&self) -> String { ... } fn placeholder(&self) -> String { ... } fn completer(&self) -> &dyn Completer { ... } fn crashed(&self) -> String { ... }
}
Expand description

What the app tells the shell.

Required Associated Types§

Source

type Msg: Send + 'static

What a command’s worker thread hands back, to App::done.

Source

type Panel: Panel

The app’s own panels.

Required Methods§

Source

fn commands(&self) -> Vec<CommandInfo>

The commands for the menu and /help (the shell adds its built-ins after them).

Source

fn run(&mut self, line: &str, ctx: &mut Ctx<'_, Self>)

A line the user sent that isn’t a built-in. Long work goes on a worker thread with Ctx::start; output goes through crate::out.

Provided Methods§

Source

fn launch(&mut self, ctx: &mut Ctx<'_, Self>)

When the shell opens, after the screen is up.

Source

fn done(&mut self, msg: Self::Msg, ctx: &mut Ctx<'_, Self>)

A worker thread finished with msg.

Source

fn panel_event( &mut self, event: <Self::Panel as Panel>::Event, ctx: &mut Ctx<'_, Self>, )

The open panel asked for something.

Source

fn tick(&mut self, ctx: &mut Ctx<'_, Self>)

Every tick (about 80 ms): background checks, timers.

Source

fn refresh(&mut self)

After a command or a settings change: re-read what may have changed. The shell reads the header, notices, footer and placeholder again after.

Source

fn header(&self) -> Vec<Row> ⓘ

Beside the logo. The shell shows its title when this is empty.

Source

fn notices(&self) -> Vec<Notice>

Messages for the right of the status bar, most important first.

Source

fn footer(&self) -> String

Under the input box.

Source

fn placeholder(&self) -> String

In the empty input box.

Source

fn completer(&self) -> &dyn Completer

Values for the command menu.

Source

fn crashed(&self) -> String

Said when a worker thread panics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§