Struct sixtyfps::VecModel[]

pub struct VecModel<T> { /* fields omitted */ }

A model backed by a SharedVector

Implementations

impl<T> VecModel<T> where
    T: 'static, 

pub fn from_slice(slice: &[T]) -> ModelHandle<T> where
    T: Clone

Allocate a new model from a slice

pub fn push(&self, value: T)

Add a row at the end of the model

pub fn remove(&self, index: usize)

Remove the row at the given index from the model

Trait Implementations

impl<T> Default for VecModel<T> where
    T: Default

pub fn default() -> VecModel<T>

Returns the “default value” for a type. Read more

impl<T> From<Vec<T, Global>> for VecModel<T>

pub fn from(array: Vec<T, Global>) -> VecModel<T>

Performs the conversion.

impl<T> Model for VecModel<T> where
    T: Clone

type Data = T

The model data: A model is a set of row and each row has this data

pub fn row_count(&self) -> usize

The amount of row in the model

pub fn row_data(&self, row: usize) -> <VecModel<T> as Model>::Data

Returns the data for a particular row. This function should be called with row < row_count().

pub fn set_row_data(&self, row: usize, data: <VecModel<T> as Model>::Data)

Sets the data for a particular row. This function should be called with row < row_count(). If the model cannot support data changes, then it is ok to do nothing (default implementation). If the model can update the data, it should also call row_changed on its internal ModelNotify. Read more

pub fn attach_peer(&self, peer: ModelPeer)

Should forward to the internal ModelNotify::attach

fn iter(&'a self) -> ModelIterator<'a, Self::Data>

Notable traits for ModelIterator<'a, T>

impl<'a, T> Iterator for ModelIterator<'a, T> type Item = T;

Returns an iterator visiting all elements of the model.

Auto Trait Implementations

impl<T> !RefUnwindSafe for VecModel<T>

impl<T> !Send for VecModel<T>

impl<T> !Sync for VecModel<T>

impl<T> Unpin for VecModel<T> where
    T: Unpin

impl<T> !UnwindSafe for VecModel<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.