pub struct EditorModel {
pub recipe_name: String,
pub recipe_description: String,
pub nodes: Vec<EditorNode>,
pub selected_index: Option<usize>,
pub dirty: bool,
pub undo_stack: Vec<EditorSnapshot>,
pub redo_stack: Vec<EditorSnapshot>,
pub source: EditorSource,
}Expand description
The main editor state. Pure data — all mutations are method calls that modify fields in place. No I/O, no side effects.
Fields§
§recipe_name: String§recipe_description: String§nodes: Vec<EditorNode>§selected_index: Option<usize>§dirty: bool§undo_stack: Vec<EditorSnapshot>§redo_stack: Vec<EditorSnapshot>§source: EditorSourceImplementations§
Source§impl EditorModel
impl EditorModel
Sourcepub fn from_definition(def: &Definition, source: EditorSource) -> Self
pub fn from_definition(def: &Definition, source: EditorSource) -> Self
Build an editor model from a parsed Definition.
Sourcepub fn to_definition(&self) -> Definition
pub fn to_definition(&self) -> Definition
Serialize the editor state back to a Definition.
Source§impl EditorModel
impl EditorModel
Source§impl EditorModel
impl EditorModel
Sourcepub fn add_node(&mut self, node_type: &str, info: &NodeTypeInfo)
pub fn add_node(&mut self, node_type: &str, info: &NodeTypeInfo)
Add a node with defaults populated from engine metadata.
Sourcepub fn add_node_with_defaults(
&mut self,
node_type: &str,
info: &NodeTypeInfo,
param_defaults: &[(String, Value)],
)
pub fn add_node_with_defaults( &mut self, node_type: &str, info: &NodeTypeInfo, param_defaults: &[(String, Value)], )
Add a node with pre-populated default parameter values from metadata.
Sourcepub fn remove_node(&mut self, index: usize)
pub fn remove_node(&mut self, index: usize)
Remove the node at the given index.
Sourcepub fn update_param(&mut self, index: usize, key: &str, value: Value)
pub fn update_param(&mut self, index: usize, key: &str, value: Value)
Update a single parameter value on the node at index.
Sourcepub fn mark_clean(&mut self)
pub fn mark_clean(&mut self)
Mark the model as clean (after a successful save).
Source§impl EditorModel
impl EditorModel
Trait Implementations§
Source§impl Clone for EditorModel
impl Clone for EditorModel
Source§fn clone(&self) -> EditorModel
fn clone(&self) -> EditorModel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EditorModel
impl Debug for EditorModel
Auto Trait Implementations§
impl Freeze for EditorModel
impl RefUnwindSafe for EditorModel
impl Send for EditorModel
impl Sync for EditorModel
impl Unpin for EditorModel
impl UnsafeUnpin for EditorModel
impl UnwindSafe for EditorModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more