refactor!: Rewrote device implementation macro once again
This time with a bit more though put into the design of the code, as a result the macro should be a lot more robust. This did result in the macro getting renamed from LuaDevice to Device as this should be _the_ Device macro. The attribute also got renamed from traits() to device(traits()) and the syntax got overhauled to allow for a bit more expression.
This commit is contained in:
@@ -9,7 +9,7 @@ use automation_lib::event::OnMqtt;
|
||||
use automation_lib::lua::traits::AddAdditionalMethods;
|
||||
use automation_lib::messages::PresenceMessage;
|
||||
use automation_lib::mqtt::WrappedAsyncClient;
|
||||
use automation_macro::{LuaDevice, LuaDeviceConfig};
|
||||
use automation_macro::{Device, LuaDeviceConfig};
|
||||
use rumqttc::Publish;
|
||||
use tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
use tracing::{debug, trace, warn};
|
||||
@@ -34,8 +34,8 @@ pub struct State {
|
||||
current_overall_presence: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, LuaDevice)]
|
||||
#[traits(AddAdditionalMethods)]
|
||||
#[derive(Debug, Clone, Device)]
|
||||
#[device(traits(AddAdditionalMethods))]
|
||||
pub struct Presence {
|
||||
config: Config,
|
||||
state: Arc<RwLock<State>>,
|
||||
|
||||
Reference in New Issue
Block a user