Skip to content

Commit

Permalink
Optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
GamePad64 committed Oct 27, 2024
1 parent 8e6d399 commit 3656e9c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions notifico-core/src/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@ impl SerializedStep {
self.0["step"].as_str().expect("Step type must be a string")
}

fn into_inner(self) -> serde_json::Map<String, Value> {
self.0
}

fn into_value(self) -> Value {
Value::Object(self.into_inner())
}

pub fn convert_step<T>(self) -> Result<T, EngineError>
where
T: for<'de> Deserialize<'de>,
{
let s = serde_json::to_string(&self.into_value()).map_err(EngineError::InvalidStep)?;
serde_json::from_str(&s).map_err(EngineError::InvalidStep)
T::deserialize(self.0).map_err(EngineError::InvalidStep)
}
}

0 comments on commit 3656e9c

Please sign in to comment.