pub struct VecModel { /* private fields */ }Expand description
A TableModel over Vec<Vec<String>>.
Rows are keyed by their index as text unless keys are supplied with
with_keys; give real keys whenever the rows can be
reloaded in a different order, or focus cannot follow the record.
Implementations§
Source§impl VecModel
impl VecModel
Sourcepub fn with_keys(self, keys: Vec<RowKey>) -> Self
pub fn with_keys(self, keys: Vec<RowKey>) -> Self
Builder: one key per row, index-aligned with the rows. A row without a key (the vector is too short) falls back to its index.
Sourcepub fn with_row_roles(self, roles: Vec<Option<Role>>) -> Self
pub fn with_row_roles(self, roles: Vec<Option<Role>>) -> Self
Builder: one optional row role per row, index-aligned with the rows
(see TableModel::row_role). A shorter vector leaves the remaining
rows plain.
Trait Implementations§
Source§impl TableModel for VecModel
impl TableModel for VecModel
Source§fn set_cell(&mut self, row: usize, col: usize, text: &str) -> Result<(), String>
fn set_cell(&mut self, row: usize, col: usize, text: &str) -> Result<(), String>
Replace the cell’s text. A row too short for col is padded with
empty cells; a missing row is an error.
Source§fn cell(&self, row: usize, col: usize) -> Cow<'_, str>
fn cell(&self, row: usize, col: usize) -> Cow<'_, str>
The text of cell (
row, col). An out-of-range column yields "".Source§fn row_key(&self, row: usize) -> RowKey
fn row_key(&self, row: usize) -> RowKey
Stable identity of a row; focus and selection follow the key across
reloads.
Auto Trait Implementations§
impl Freeze for VecModel
impl RefUnwindSafe for VecModel
impl Send for VecModel
impl Sync for VecModel
impl Unpin for VecModel
impl UnsafeUnpin for VecModel
impl UnwindSafe for VecModel
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.