1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
use crate::utils::event::Event;

/// # Trait that any of the widgets have to implement
pub trait Widget {
    /// Return the HTML representation of the widget
    fn eval(&self) -> String;

    /// Trigger functions depending on the event
    fn trigger(&mut self, _event: &Event);

    /// Function triggered on update event
    fn on_update(&mut self);

    /// Function triggered on change event
    fn on_change(&mut self, _value: &str);
}