Struct foxbox_thinkerbell::ast::Statement
[−]
[src]
pub struct Statement<Ctx> where Ctx: Context {
pub destination: Vec<SetterSelector>,
pub value: Value,
pub kind: ChannelKind,
pub phantom: PhantomData<Ctx>,
}
Stuff to actually do. In practice, this means placing calls to devices.
JSON
A statement is represented as an object with the following fields: - destination (array of SetterSelector); - value (Value); - kind (ChannelKind);
extern crate foxbox_thinkerbell; extern crate foxbox_taxonomy; use foxbox_thinkerbell::ast::*; use foxbox_taxonomy::values::*; use foxbox_taxonomy::services::*; use foxbox_taxonomy::parse::*; let source = r#"{ "destination": [{"id": "my setter"}], "value": {"OnOff": "Off"}, "kind": "OnOff" }"#; let statement = Statement::<UncheckedCtx>::from_str(&source).unwrap(); assert_eq!(statement.value, Value::OnOff(OnOff::Off)); assert_eq!(statement.kind, ChannelKind::OnOff);
Fields
destination | The set of setters to which to send a command. Note that the set of setters may change (e.g. when devices are added/removed) without rebooting the script. |
value | Data to send to the resource. During compilation, we check
that the type of |
kind | The kind of channel expected from |
phantom |