wled_json_api_library/structures/
live.rs1use serde;
2use serde::{Serialize, Deserialize};
3use crate::errors::WledJsonApiError;
4use crate::structures::none_function;
5
6
7
8#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
10#[serde(rename_all = "camelCase")]
11pub struct Live {
12 #[serde(skip_serializing_if = "Option::is_none")]
14 #[serde(default = "none_function")]
15 pub leds: Option<Vec<String>>,
16
17 #[serde(skip_serializing_if = "Option::is_none")]
19 #[serde(default = "none_function")]
20 pub n: Option<i64>,
21}
22
23impl TryFrom<&str> for Live{
24 type Error = WledJsonApiError;
25 fn try_from(str_in: &str) -> Result<Live, WledJsonApiError> {
26 serde_json::from_str(str_in).map_err(|e| {WledJsonApiError::SerdeError(e)})
27 }
28}
29