termrs_runtime 0.3.0

Runtime for termrs applications
Documentation
use core::widget::Widget;

pub trait App<Message> {
    /// Returns the application view based on it's current state.
    fn view(&self) -> impl Widget<Message>;

    /// React to the message and by updating the state.
    fn update(&mut self, message: Message, context: &mut impl AppContext);
}

pub trait AppContext {
    fn terminate_app(&mut self);
}

impl AppContext for bool {
    fn terminate_app(&mut self) {
        *self = true
    }
}