pub struct Device { /* private fields */ }Expand description
Represents a device.
For the details of fields, please refer to the devices section of the API documentation.
Implementations§
Source§impl Device
impl Device
Sourcepub fn device_name(&self) -> &str
pub fn device_name(&self) -> &str
The device name. This is the name configured in the SwitchBot app.
Sourcepub fn device_type(&self) -> &str
pub fn device_type(&self) -> &str
The device type. This is empty if this is an infrared remote device.
Sourcepub fn remote_type(&self) -> &str
pub fn remote_type(&self) -> &str
The device type for an infrared remote device.
Sourcepub fn hub_device_id(&self) -> &str
pub fn hub_device_id(&self) -> &str
The parent Hub ID.
Sourcepub async fn command(&self, command: &CommandRequest) -> Result<()>
pub async fn command(&self, command: &CommandRequest) -> Result<()>
Send the command to the SwitchBot API.
Please also see the CommandRequest.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Device
impl<'de> Deserialize<'de> for Device
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 Device
impl !RefUnwindSafe for Device
impl !Send for Device
impl !Sync for Device
impl Unpin for Device
impl !UnwindSafe for Device
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> 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.