#[non_exhaustive]pub enum TreeMutation<T> {
Insert {
parent: Option<T>,
index: usize,
item: TreeItem<T>,
},
Remove {
id: T,
},
Update {
item: TreeItem<T>,
},
Move {
id: T,
new_parent: Option<T>,
index: usize,
},
SetExpanded {
id: T,
expanded: bool,
},
}Expand description
Atomic retained-tree mutation.
Indices are zero-based insertion positions in the selected root/child list. A batch validates against a clone and commits all mutations or none.
§Examples
use ailloli_ui_widgets::controls::{TreeItem, TreeMutation};
let mutation = TreeMutation::Insert { parent: None, index: 0, item: TreeItem::leaf(1, "file") };
assert!(matches!(mutation, TreeMutation::Insert { index: 0, .. }));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Insert
Inserts a new, never-used ID at a root or child position.
Fields
Remove
Removes the identified item and its entire descendant subtree.
Fields
§
id: TExisting root or descendant ID to retire.
Update
Replaces item metadata while preserving hierarchy and expansion.
Move
Moves an existing subtree to a root or branch position.
Fields
§
id: TExisting subtree root ID.
SetExpanded
Changes expansion on an existing branch.
Trait Implementations§
Source§impl<T: Clone> Clone for TreeMutation<T>
impl<T: Clone> Clone for TreeMutation<T>
Source§fn clone(&self) -> TreeMutation<T>
fn clone(&self) -> TreeMutation<T>
Returns a copy 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<T: Debug> Debug for TreeMutation<T>
impl<T: Debug> Debug for TreeMutation<T>
Source§impl<T: PartialEq> PartialEq for TreeMutation<T>
impl<T: PartialEq> PartialEq for TreeMutation<T>
impl<T> StructuralPartialEq for TreeMutation<T>
Auto Trait Implementations§
impl<T> Freeze for TreeMutation<T>where
T: Freeze,
impl<T> RefUnwindSafe for TreeMutation<T>where
T: RefUnwindSafe,
impl<T> Send for TreeMutation<T>where
T: Send,
impl<T> Sync for TreeMutation<T>where
T: Sync,
impl<T> Unpin for TreeMutation<T>where
T: Unpin,
impl<T> UnwindSafe for TreeMutation<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.