pub struct Command {
pub command_id: String,
pub key: String,
pub target_type: TargetType,
pub device_id: Option<i32>,
pub device_name: Option<String>,
pub params: Option<Value>,
pub timeout_ms: Option<u64>,
pub timestamp: DateTime<Utc>,
}Expand description
Northward envelope protocol types (re-exported at crate root). Command message received from platform
Fields§
§command_id: StringCommand identifier
key: StringCommand type/name
target_type: TargetTypeTarget type
device_id: Option<i32>Device identifier
device_name: Option<String>Device name
params: Option<Value>Command parameters
timeout_ms: Option<u64>Command expiration time
timestamp: DateTime<Utc>Timestamp when command was issued
Implementations§
Source§impl Command
impl Command
Sourcepub fn new(
command_id: String,
key: String,
target_type: TargetType,
device_id: i32,
device_name: String,
params: Value,
) -> Self
pub fn new( command_id: String, key: String, target_type: TargetType, device_id: i32, device_name: String, params: Value, ) -> Self
Create new command
Sourcepub fn with_timeout(self, timeout_ms: u64) -> Self
pub fn with_timeout(self, timeout_ms: u64) -> Self
Set command timeout
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if command has expired
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Command
impl<'de> Deserialize<'de> for Command
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.