Added deref to impl_device to account for changes in mlua 0.10
This commit is contained in:
parent
8b04435537
commit
9719c46136
|
@ -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())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user