Rewrote impl_cast as a proc_macro to make it easier to work with

This commit is contained in:
2023-04-12 01:17:06 +02:00
parent b54c9512b9
commit ca8821b406
10 changed files with 243 additions and 121 deletions

View File

@@ -4,11 +4,12 @@ use crate::{
errors::{DeviceError, ErrorCode},
request::execute::CommandType,
response,
traits::{As, OnOff, Scene, Trait},
traits::{OnOff, Scene, Trait},
types::Type,
};
pub trait GoogleHomeDevice: As<dyn OnOff> + As<dyn Scene> + 'static {
#[impl_cast::device(As: OnOff + Scene)]
pub trait GoogleHomeDevice: Sync + Send + 'static {
fn get_device_type(&self) -> Type;
fn get_device_name(&self) -> Name;
fn get_id(&self) -> &str;