Enum initiative_core::storage::repository::Change
source · 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”).
Trait Implementations§
impl Eq for Change
impl StructuralPartialEq for Change
Auto Trait Implementations§
impl Freeze for Change
impl RefUnwindSafe for Change
impl Send for Change
impl Sync for Change
impl Unpin for Change
impl UnwindSafe for Change
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)