Skip to main content

AppScreen

Trait AppScreen 

Source
pub trait AppScreen: Send {
    // Required methods
    fn handle_input(&mut self, event: &InputEvent, tx: &AppTx) -> EventState;
    fn render(&mut self, f: &mut Frame<'_>);
    fn get_kind(&self) -> ScreenKind;

    // Provided methods
    fn on_enter<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _tx: &'life1 AppTx,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn handle_app_message<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _msg: AppEvent,
        _tx: &'life1 AppTx,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn try_open_path<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        path: VaultPath,
        _emphasis: Option<Vec<String>>,
        _tx: &'life1 AppTx,
    ) -> Pin<Box<dyn Future<Output = Option<VaultPath>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn try_open_attachment<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        path: VaultPath,
        _tx: &'life1 AppTx,
    ) -> Pin<Box<dyn Future<Output = Option<VaultPath>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_exit<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _tx: &'life1 AppTx,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn handle_input(&mut self, event: &InputEvent, tx: &AppTx) -> EventState

Handle an input event. Send events through tx for navigation or quit. Returns whether this screen consumed the event.

Source

fn render(&mut self, f: &mut Frame<'_>)

Source

fn get_kind(&self) -> ScreenKind

Provided Methods§

Source

fn on_enter<'life0, 'life1, 'async_trait>( &'life0 mut self, _tx: &'life1 AppTx, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called once when the screen mounts. Send AppEvents through tx to trigger navigation (e.g. StartScreen checking whether a vault exists).

Source

fn handle_app_message<'life0, 'life1, 'async_trait>( &'life0 mut self, _msg: AppEvent, _tx: &'life1 AppTx, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle an application-level event owned by this screen. Events the screen does not recognize are silently ignored. The default implementation handles nothing.

Source

fn try_open_path<'life0, 'life1, 'async_trait>( &'life0 mut self, path: VaultPath, _emphasis: Option<Vec<String>>, _tx: &'life1 AppTx, ) -> Pin<Box<dyn Future<Output = Option<VaultPath>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Try to open path within this screen (e.g. load a note into the buffer, or navigate a sidebar). Return Some(path) if the screen does not handle it, in which case the main loop switches to an appropriate screen. Default: not handled. emphasis carries the originating query’s needles when the open came from a query result; only the editor screen uses it (spec §5.1) — it is dropped when the open reroutes to a screen switch.

Source

fn try_open_attachment<'life0, 'life1, 'async_trait>( &'life0 mut self, path: VaultPath, _tx: &'life1 AppTx, ) -> Pin<Box<dyn Future<Output = Option<VaultPath>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Try to open the attachment at path within this screen (the editor screen shows it in its read-only attachment view). Return Some(path) if the screen does not handle it, in which case the main loop routes it to the editor screen. Default: not handled.

Source

fn on_exit<'life0, 'life1, 'async_trait>( &'life0 mut self, _tx: &'life1 AppTx, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called once just before the screen is removed from the app (quit or screen transition). Default implementation is a no-op.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§