Skip to main content

run

Function run 

Source
pub fn run<A>(app: A, config: RunnerConfig) -> Result<(), Error>
where A: CoordinatorApp,
Expand description

Run a coordinator application with the ratkit core runtime.

This function sets up the terminal, creates a Runner, and runs the event loop until the application requests to quit.

ยงExample

use ratkit::prelude::*;
use ratatui::Frame;

struct MyApp;

impl CoordinatorApp for MyApp {
    fn on_event(&mut self, event: CoordinatorEvent) -> LayoutResult<CoordinatorAction> {
        Ok(CoordinatorAction::Continue)
    }

    fn on_draw(&mut self, frame: &mut Frame) {
        // Draw your UI here
    }
}

fn main() -> std::io::Result<()> {
    let app = MyApp;
    run(app, RunnerConfig::default())
}