pub struct TreeModelDelta<T> { /* private fields */ }Expand description
One successfully committed atomic batch.
Empty batches return the current revision and no mutations without advancing the model. Nonempty batches advance exactly once.
§Examples
use ailloli_ui_widgets::controls::{TreeItem, TreeModel, TreeMutation};
let mut model = TreeModel::new();
let delta = model.apply(TreeMutation::Insert { parent: None, index: 0, item: TreeItem::leaf(1, "file") }).unwrap();
assert_eq!(delta.revision(), 1);
assert_eq!(delta.mutations().len(), 1);Implementations§
Source§impl<T> TreeModelDelta<T>
impl<T> TreeModelDelta<T>
Sourcepub const fn revision(&self) -> u64
pub const fn revision(&self) -> u64
Returns the model revision after commit.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeMutation};
let mut model = TreeModel::<u8>::new();
assert_eq!(model.apply_batch(Vec::<TreeMutation<u8>>::new()).unwrap().revision(), 0);Sourcepub fn mutations(&self) -> &[TreeMutation<T>]
pub fn mutations(&self) -> &[TreeMutation<T>]
Borrows committed mutations in input order.
§Examples
use ailloli_ui_widgets::controls::{TreeModel, TreeMutation};
let mut model = TreeModel::<u8>::new();
let delta = model.apply_batch(Vec::<TreeMutation<u8>>::new()).unwrap();
assert!(delta.mutations().is_empty());Trait Implementations§
Source§impl<T: Clone> Clone for TreeModelDelta<T>
impl<T: Clone> Clone for TreeModelDelta<T>
Source§fn clone(&self) -> TreeModelDelta<T>
fn clone(&self) -> TreeModelDelta<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 TreeModelDelta<T>
impl<T: Debug> Debug for TreeModelDelta<T>
Source§impl<T: PartialEq> PartialEq for TreeModelDelta<T>
impl<T: PartialEq> PartialEq for TreeModelDelta<T>
impl<T> StructuralPartialEq for TreeModelDelta<T>
Auto Trait Implementations§
impl<T> Freeze for TreeModelDelta<T>
impl<T> RefUnwindSafe for TreeModelDelta<T>where
T: RefUnwindSafe,
impl<T> Send for TreeModelDelta<T>where
T: Send,
impl<T> Sync for TreeModelDelta<T>where
T: Sync,
impl<T> Unpin for TreeModelDelta<T>where
T: Unpin,
impl<T> UnwindSafe for TreeModelDelta<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.