No more cast_mut()

This commit is contained in:
2024-07-26 00:37:53 +02:00
parent 6c797820dc
commit 3fd8dddeb2
7 changed files with 29 additions and 39 deletions

View File

@@ -56,7 +56,7 @@ pub trait Device: DeviceFulfillment {
device
}
async fn execute(&mut self, command: Command) -> Result<(), ErrorCode> {
async fn execute(&self, command: Command) -> Result<(), ErrorCode> {
DeviceFulfillment::execute(self, command.clone())
.await
.unwrap();

View File

@@ -138,7 +138,7 @@ impl GoogleHome {
let execution = command.execution.clone();
async move {
if let Some(device) = devices.get(id.as_str())
&& let Some(device) = device.write().await.as_mut().cast_mut()
&& let Some(device) = device.write().await.as_ref().cast()
{
if !device.is_online() {
return (id, Ok(false));