diff options
Diffstat (limited to 'crates/core/c8y_smartrest')
-rw-r--r-- | crates/core/c8y_smartrest/src/smartrest_deserializer.rs | 1 | ||||
-rw-r--r-- | crates/core/c8y_smartrest/src/smartrest_serializer.rs | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/crates/core/c8y_smartrest/src/smartrest_deserializer.rs b/crates/core/c8y_smartrest/src/smartrest_deserializer.rs index 841915b7..d9868e81 100644 --- a/crates/core/c8y_smartrest/src/smartrest_deserializer.rs +++ b/crates/core/c8y_smartrest/src/smartrest_deserializer.rs @@ -177,6 +177,7 @@ where // 2021-10-23T19:03:26+01:00 // so we add a ':' let mut date_string: String = Deserialize::deserialize(deserializer)?; + let str_size = date_string.len(); // check if `date_string` does not have a colon. let date_string_end = &date_string.split('+').last(); diff --git a/crates/core/c8y_smartrest/src/smartrest_serializer.rs b/crates/core/c8y_smartrest/src/smartrest_serializer.rs index 81e7ed4f..6504567d 100644 --- a/crates/core/c8y_smartrest/src/smartrest_serializer.rs +++ b/crates/core/c8y_smartrest/src/smartrest_serializer.rs @@ -1,6 +1,6 @@ use crate::error::SmartRestSerializerError; use csv::{QuoteStyle, WriterBuilder}; -use json_sm::{SoftwareOperationStatus, SoftwareUpdateResponse}; +use json_sm::{OperationStatus, SoftwareUpdateResponse}; use serde::{Deserialize, Serialize, Serializer}; type SmartRest = String; @@ -104,7 +104,7 @@ impl SmartRestSetOperationToExecuting { response: SoftwareUpdateResponse, ) -> Result<Self, SmartRestSerializerError> { match response.status() { - SoftwareOperationStatus::Executing => { + OperationStatus::Executing => { Ok(Self::new(CumulocitySupportedOperations::C8ySoftwareUpdate)) } _ => Err(SmartRestSerializerError::UnsupportedOperationStatus { response }), @@ -141,7 +141,7 @@ impl SmartRestSetOperationToSuccessful { response: SoftwareUpdateResponse, ) -> Result<Self, SmartRestSerializerError> { match response.status() { - SoftwareOperationStatus::Successful => { + OperationStatus::Successful => { Ok(Self::new(CumulocitySupportedOperations::C8ySoftwareUpdate)) } _ => Err(SmartRestSerializerError::UnsupportedOperationStatus { response }), @@ -172,7 +172,7 @@ impl SmartRestSetOperationToFailed { response: SoftwareUpdateResponse, ) -> Result<Self, SmartRestSerializerError> { match &response.status() { - SoftwareOperationStatus::Failed => Ok(Self::new( + OperationStatus::Failed => Ok(Self::new( CumulocitySupportedOperations::C8ySoftwareUpdate, response.error().unwrap_or_else(|| "".to_string()), )), |