pub enum Change {
Create {
thing_data: ThingData,
uuid: Option<Uuid>,
},
CreateAndSave {
thing_data: ThingData,
uuid: Option<Uuid>,
},
Delete {
uuid: Uuid,
name: String,
},
Edit {
name: String,
uuid: Option<Uuid>,
diff: ThingData,
},
EditAndUnsave {
uuid: Uuid,
name: String,
diff: ThingData,
},
Save {
name: String,
uuid: Option<Uuid>,
},
Unsave {
uuid: Uuid,
name: String,
},
SetKeyValue {
key_value: KeyValue,
},
}
Expand description
Represents a modification to be applied to the Repository. This is passed to Repository::modify() to be applied. An object is used to represent the change because every operation has an opposite; for instance, Unsave is the opposite of Save, and Edit is the opposite of Edit. This opposite is inserted into the undo history and can be applied using Repository::undo().
Variants§
Create
Create a new thing and store it in recent entries.
Reverse: Delete
CreateAndSave
Create a new thing and store it in the journal.
Reverse: Delete
Delete
Delete a thing from recent or journal.
Reverse: Create (recent) or CreateAndSave (journal)
Edit
Edit fields on a Thing.
Reverse: Edit (already in journal) or EditAndUnsave (in recent)
EditAndUnsave
Edit a Thing and move it from journal to recent. The reverse of edit with autosave.
Reverse: Edit
Save
Transfer a thing from recent to journal.
Reverse: Unsave
Unsave
Transfer a thing from journal to recent. Only triggerable as the reverse to Save.
Reverse: Save
SetKeyValue
Set a value in the key-value store.
Reverse: SetKeyValue
Implementations§
Source§impl Change
impl Change
Sourcepub fn display_undo(&self) -> DisplayUndo<'_>
pub fn display_undo(&self) -> DisplayUndo<'_>
Describe how applying this change from the undo queue will affect the application state (“undo change xyz”).
Sourcepub fn display_redo(&self) -> DisplayRedo<'_>
pub fn display_redo(&self) -> DisplayRedo<'_>
Describe how applyifrom the redo queue will affect the application state (“redo change xyz”).