Updated rust toolchain
All checks were successful
Build and deploy / Build application (push) Successful in 4m7s
Build and deploy / Build container (push) Successful in 1m2s
Build and deploy / Deploy container (push) Successful in 35s

This commit is contained in:
Dreaded_X 2024-12-08 00:57:57 +01:00
parent e8d5698835
commit 14aabe202d
Signed by: Dreaded_X
GPG Key ID: FA5F485356B0D2D4
2 changed files with 1 additions and 45 deletions

View File

@ -120,9 +120,6 @@ impl OnOff for HueGroup {
} }
mod message { mod message {
use std::time::Duration;
use serde::ser::SerializeStruct;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
@ -164,46 +161,5 @@ mod message {
pub fn any_on(&self) -> bool { pub fn any_on(&self) -> bool {
self.state.any_on self.state.any_on
} }
// pub fn all_on(&self) -> bool {
// self.state.all_on
// }
}
#[derive(Debug)]
pub struct Timeout {
timeout: Option<Duration>,
}
impl Timeout {
pub fn new(timeout: Option<Duration>) -> Self {
Self { timeout }
}
}
impl Serialize for Timeout {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let len = if self.timeout.is_some() { 2 } else { 1 };
let mut state = serializer.serialize_struct("TimerMessage", len)?;
if self.timeout.is_some() {
state.serialize_field("status", "enabled")?;
} else {
state.serialize_field("status", "disabled")?;
}
if let Some(timeout) = self.timeout {
let seconds = timeout.as_secs() % 60;
let minutes = (timeout.as_secs() / 60) % 60;
let hours = timeout.as_secs() / 3600;
let time = format!("PT{hours:<02}:{minutes:<02}:{seconds:<02}");
state.serialize_field("localtime", &time)?;
};
state.end()
}
} }
} }

View File

@ -1,4 +1,4 @@
[toolchain] [toolchain]
channel = "nightly-2024-07-25" channel = "nightly-2024-12-06"
components = ["rustfmt", "clippy", "rust-analyzer"] components = ["rustfmt", "clippy", "rust-analyzer"]
profile = "minimal" profile = "minimal"