pub struct CommandRequest {
pub command: String,
pub parameter: String,
pub command_type: String,
}
Expand description
A command request to send to the SwitchBot API.
For more details of each field, please refer to the SwitchBot documentation about device control commands.
§Examples
let command = CommandRequest {
command: "turnOn".into(),
..Default::default()
};
Fields§
§command: String
The command.
parameter: String
The command parameters.
command_type: String
The command type.
Trait Implementations§
Source§impl Clone for CommandRequest
impl Clone for CommandRequest
Source§fn clone(&self) -> CommandRequest
fn clone(&self) -> CommandRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CommandRequest
impl Debug for CommandRequest
Source§impl Default for CommandRequest
impl Default for CommandRequest
Source§fn default() -> CommandRequest
fn default() -> CommandRequest
Returns the “default value” for a type. Read more
Source§impl Display for CommandRequest
impl Display for CommandRequest
Source§impl From<&str> for CommandRequest
impl From<&str> for CommandRequest
Source§fn from(text: &str) -> Self
fn from(text: &str) -> Self
Parse a string into a CommandRequest
.
Please see the switchbot-cli
document for the syntax.
assert_eq!(
CommandRequest::from("turnOn"),
CommandRequest {
command: "turnOn".into(),
..Default::default()
}
);
assert_eq!(
CommandRequest::from("turnOn:parameter:colon/slash"),
CommandRequest {
command: "turnOn".into(),
parameter: "parameter:colon/slash".into(),
..Default::default()
}
);
assert_eq!(
CommandRequest::from("customize/turnOn"),
CommandRequest {
command: "turnOn".into(),
command_type: "customize".into(),
..Default::default()
}
);
assert_eq!(
CommandRequest::from("customize/turnOn:parameter:colon/slash"),
CommandRequest {
command: "turnOn".into(),
command_type: "customize".into(),
parameter: "parameter:colon/slash".into(),
}
);
Source§impl PartialEq for CommandRequest
impl PartialEq for CommandRequest
Source§impl Serialize for CommandRequest
impl Serialize for CommandRequest
impl StructuralPartialEq for CommandRequest
Auto Trait Implementations§
impl Freeze for CommandRequest
impl RefUnwindSafe for CommandRequest
impl Send for CommandRequest
impl Sync for CommandRequest
impl Unpin for CommandRequest
impl UnwindSafe for CommandRequest
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.