Renamed from to cast_mut and added version that is not mutable

This commit is contained in:
2022-12-14 05:33:13 +01:00
parent 36cd0e9b61
commit fd1540b63d
2 changed files with 18 additions and 6 deletions

View File

@@ -35,7 +35,7 @@ fn main() {
let mut notifier = Notifier::new();
// Update the state of the kettle
AsStateOnOff::from(devices.borrow_mut().get_device("kitchen/kettle").unwrap()).unwrap().set_state(false);
AsStateOnOff::cast_mut(devices.borrow_mut().get_device("kitchen/kettle").unwrap()).unwrap().set_state(false);
notifier.add_listener(Rc::downgrade(&devices));