gooey/interface/model/
mod.rs

1//! Domain data bindings
2
3use crate::application;
4use crate::interface::CreateOrder;
5use crate::tree::NodeId;
6
7pub mod component;
8pub use self::component::Component;
9
10/// A data component associated with application events and callbacks
11#[derive(Clone, Debug, Default)]
12pub struct Model {
13  pub component   : Component,
14  pub callback_id : Option <application::CallbackId>
15}
16
17/// A change in domain data to be processed by the `Application`.
18#[derive(Debug)]
19pub enum Event {
20  Create (Model, NodeId, CreateOrder),
21  Submit (Model),
22  Update (Model),
23  Destroy
24}
25
26impl From <Component> for Model {
27  fn from (component : Component) -> Self {
28    Model { component, .. Model::default() }
29  }
30}