pub struct VecModel<T>(/* private fields */);Expand description
A shared UI-thread model with separately tracked row and length reads. Cloning the handle shares its data and subscriptions.
Implementations§
Source§impl<T> VecModel<T>
impl<T> VecModel<T>
Sourcepub fn row_key(&self, index: usize) -> Option<RowKey>
pub fn row_key(&self, index: usize) -> Option<RowKey>
A stable identity that survives edits, inserts, removes of other rows, and sorting.
Sourcepub fn row_index(&self, key: RowKey) -> Option<usize>
pub fn row_index(&self, key: RowKey) -> Option<usize>
Find a record’s current index by its stable identity.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn push(&self, value: T)
Sourcepub fn insert(&self, index: usize, value: T) -> bool
pub fn insert(&self, index: usize, value: T) -> bool
Insert at a model index. An index beyond the end leaves the model unchanged.
pub fn remove(&self, index: usize) -> Option<T>
Source§impl<T: PartialEq> VecModel<T>
impl<T: PartialEq> VecModel<T>
Sourcepub fn set_row_if_current(
&self,
index: usize,
key: RowKey,
expected: &T,
value: T,
) -> bool
pub fn set_row_if_current( &self, index: usize, key: RowKey, expected: &T, value: T, ) -> bool
Commit a value against the row and value observed by an editor.
Sourcepub fn update_row_if_key(
&self,
index: usize,
key: RowKey,
update: impl FnOnce(&T) -> Option<T>,
) -> bool
pub fn update_row_if_key( &self, index: usize, key: RowKey, update: impl FnOnce(&T) -> Option<T>, ) -> bool
Update an identified record from its latest value. Returning None declines the edit.
Trait Implementations§
impl<T> Eq for VecModel<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for VecModel<T>
impl<T> !Send for VecModel<T>
impl<T> !Sync for VecModel<T>
impl<T> !UnwindSafe for VecModel<T>
impl<T> Forget for VecModel<T>
impl<T> Freeze for VecModel<T>
impl<T> Unpin for VecModel<T>
impl<T> UnsafeUnpin for VecModel<T>where
Rc<ModelData<T>>: UnsafeUnpin,
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