Added deref to impl_device to account for changes in mlua 0.10
All checks were successful
Build and deploy / Build application (push) Successful in 3m26s
Build and deploy / Build container (push) Successful in 52s
Build and deploy / Deploy container (push) Successful in 32s

This commit is contained in:
Dreaded_X 2024-11-30 05:30:53 +01:00
parent 8b04435537
commit 9719c46136
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4

View File

@ -13,6 +13,7 @@ mod wake_on_lan;
mod washer; mod washer;
use std::fmt::Debug; use std::fmt::Debug;
use std::ops::Deref;
use async_trait::async_trait; use async_trait::async_trait;
use automation_cast::Cast; use automation_cast::Cast;
@ -74,8 +75,8 @@ macro_rules! impl_device {
if impls::impls!($device: OnOff) { if impls::impls!($device: OnOff) {
methods.add_async_method("set_on", |_lua, this, on: bool| async move { methods.add_async_method("set_on", |_lua, this, on: bool| async move {
(this.cast() as Option<&dyn OnOff>) (this.deref().cast() as Option<&dyn OnOff>)
.unwrap() .expect("Cast should be valid")
.set_on(on) .set_on(on)
.await .await
.unwrap(); .unwrap();
@ -84,8 +85,8 @@ macro_rules! impl_device {
}); });
methods.add_async_method("is_on", |_lua, this, _: ()| async move { methods.add_async_method("is_on", |_lua, this, _: ()| async move {
Ok((this.cast() as Option<&dyn OnOff>) Ok((this.deref().cast() as Option<&dyn OnOff>)
.unwrap() .expect("Cast should be valid")
.on() .on()
.await .await
.unwrap()) .unwrap())