feat: Use ActionCallback for schedule

This has two advantages:
- Each schedule entry can take either a single function or table of
  functions.
- We get a better type definition.
This commit is contained in:
2025-10-19 02:43:24 +02:00
parent 1ffccd955c
commit 02b87126e1
3 changed files with 6 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
use std::collections::HashMap;
use std::net::{Ipv4Addr, SocketAddr};
use automation_lib::action_callback::ActionCallback;
use automation_lib::device::Device;
use automation_macro::LuaDeviceConfig;
use lua_typed::Typed;
@@ -39,7 +40,7 @@ pub struct Config {
pub devices: Vec<Box<dyn Device>>,
#[device_config(from_lua, default)]
#[typed(default)]
pub schedule: HashMap<String, mlua::Function>,
pub schedule: HashMap<String, ActionCallback<()>>,
}
impl From<FulfillmentConfig> for SocketAddr {