Skip to content
Discussion options

You must be logged in to vote

The Value::Model expect a dyn Model<Value>

So like so: (untested)

impl Model for CellsModel {
    type Data = Value;  // Data is Value

    fn row_count(&self) -> usize {
        self.rows.len()
    }

    fn row_data(&self, row: usize) -> Option<Self::Data> {
        // maps the data to a Value
        self.rows.get(row).map(|x| Value::Model(ModelRc::new(x.clone())))
    }

    fn model_tracker(&self) -> &dyn ModelTracker {
        &()
    }
}

Same for the inner mode:

impl Model for RowModel {
    type Data = Value; // again, Data must be Value

    fn row_count(&self) -> usize {
        self.row_elements.borrow().len()
    }

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

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@oheil
Comment options

@ogoffart
Comment options

Answer selected by oheil
@oheil
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants