Use &str instead of String whenever possible

This commit is contained in:
2023-01-12 23:43:45 +01:00
parent 13f5c87c03
commit 06389d83f7
14 changed files with 76 additions and 62 deletions

View File

@@ -5,14 +5,14 @@ use crate::{response, types::Type, traits::{AsOnOff, Trait, AsScene}, errors::{D
pub trait GoogleHomeDevice: AsOnOff + AsScene {
fn get_device_type(&self) -> Type;
fn get_device_name(&self) -> Name;
fn get_id(&self) -> String;
fn get_id(&self) -> &str;
fn is_online(&self) -> bool;
// Default values that can optionally be overriden
fn will_report_state(&self) -> bool {
false
}
fn get_room_hint(&self) -> Option<String> {
fn get_room_hint(&self) -> Option<&str> {
None
}
fn get_device_info(&self) -> Option<Info> {