Trait sixtyfps::Model[]

pub trait Model {
    type Data;
    fn row_count(&self) -> usize;
fn row_data(&self, row: usize) -> Self::Data;
fn attach_peer(&self, peer: ModelPeer); fn set_row_data(&self, _row: usize, _data: Self::Data) { ... }
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;
{ ... } }

A Model is providing Data for the Repeater or ListView elements of the .60 language

Associated Types

type Data

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

Loading content...

Required methods

fn row_count(&self) -> usize

The amount of row in the model

fn row_data(&self, row: usize) -> Self::Data

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

fn attach_peer(&self, peer: ModelPeer)

Should forward to the internal ModelNotify::attach

Loading content...

Provided methods

fn set_row_data(&self, _row: usize, _data: Self::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.

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.

Loading content...

Implementations on Foreign Types

impl Model for bool

type Data = ()

pub fn row_count(&self) -> usize

pub fn row_data(&self, _row: usize) -> <bool as Model>::Data

pub fn attach_peer(&self, _peer: ModelPeer)

impl Model for usize

type Data = i32

pub fn row_count(&self) -> usize

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

pub fn attach_peer(&self, _peer: ModelPeer)

Loading content...

Implementors

impl<T> Model for ModelHandle<T>

type Data = T

pub fn row_count(&self) -> usize

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

pub fn attach_peer(&self, peer: ModelPeer)

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

type Data = T

pub fn row_count(&self) -> usize

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

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

pub fn attach_peer(&self, peer: ModelPeer)

Loading content...