wled_json_api_library/structures/
state_info.rs1use serde;
2use serde::{Serialize, Deserialize};
3use crate::errors::WledJsonApiError;
4use crate::structures::state::State;
5use crate::structures::info::Info;
6
7#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
8#[serde(rename_all = "camelCase")]
9pub struct StateInfo {
10 pub state: State,
11 pub info: Info,
12}
13
14impl TryFrom<&str> for StateInfo{
15 type Error = WledJsonApiError;
16 fn try_from(str_in: &str) -> Result<StateInfo, WledJsonApiError> {
17 serde_json::from_str(str_in).map_err(|e| {WledJsonApiError::SerdeError(e)})
18 }
19}