I currently have:
trait ListModel { fn get_stuff(&self, row: i) -> Stuff; ... } struct List { model: Rc<dyn ListModel>, ... } I think I want to change my model to use row IDs instead of usize indices. If I do this:
trait ListModel { type Key: Eq + Hash + Clone; fn get_stuff(&self, row: Key) -> Stuff; } There is no way to keep List non-generic, correct? I need to have something like these? :
struct List<M: ListModel> { model: Rc<M>, } // or struct List<K> { model: Rc<dyn ListModel<Key = K>>, ... } 1 post - 1 participant