Rename ModelHandle to SharedModel

This patch is mostly a rename now, but also contains a few small
cleanups.

SharedModel implements the Model trait itself and gracefully falls back
to an empty model is no Model was provided. This allows for some small
simplifications.

Also make sure to use the same comparision for SharedModels everywhere.
This fixes the last remaining clippy errors we had.
This commit is contained in:
Tobias Hunger 2022-01-27 19:10:16 +01:00 committed by Tobias Hunger
parent afb3f269c1
commit 018c1a6666
22 changed files with 88 additions and 112 deletions

View file

@ -20,7 +20,7 @@ fn main() {
// ANCHOR: game_logic
// Assign the shuffled Vec to the model property
let tiles_model = std::rc::Rc::new(sixtyfps::VecModel::from(tiles));
main_window.set_memory_tiles(sixtyfps::ModelHandle::new(tiles_model.clone()));
main_window.set_memory_tiles(sixtyfps::ModelRc::new(tiles_model.clone()));
let main_window_weak = main_window.as_weak();
main_window.on_check_if_pair_solved(move || {

View file

@ -20,7 +20,7 @@ fn main() {
// Assign the shuffled Vec to the model property
let tiles_model = std::rc::Rc::new(sixtyfps::VecModel::from(tiles));
main_window.set_memory_tiles(sixtyfps::ModelHandle::new(tiles_model));
main_window.set_memory_tiles(sixtyfps::ModelRc::new(tiles_model));
main_window.run();
}