aboutsummaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/command.rs b/src/command.rs
index 2ba92ea..5d3c935 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -9,6 +9,7 @@ use crate::deserialization::{
IgnoreEnd,
ResultExt,
};
+use crate::DeserializationError;
/// A command.
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -88,7 +89,15 @@ pub enum Error
/// Deserialization failed.
#[error("Deserialization failed")]
- DeserializationFailed(#[from] DeserializerError),
+ DeserializationFailed(#[from] DeserializationError),
+}
+
+impl From<DeserializerError> for Error
+{
+ fn from(err: DeserializerError) -> Self
+ {
+ DeserializationError(err).into()
+ }
}
/// A command prototype.
@@ -160,7 +169,15 @@ pub enum PrototypeError
/// Deserialization failed.
#[error("Deserialization failed")]
- DeserializationFailed(#[from] DeserializerError),
+ DeserializationFailed(#[from] DeserializationError),
+}
+
+impl From<DeserializerError> for PrototypeError
+{
+ fn from(err: DeserializerError) -> Self
+ {
+ DeserializationError(err).into()
+ }
}
/// A command parameter.
@@ -228,7 +245,15 @@ pub enum ParameterError
/// Deserialization failed.
#[error("Deserialization failed")]
- DeserializationFailed(#[from] DeserializerError),
+ DeserializationFailed(#[from] DeserializationError),
+}
+
+impl From<DeserializerError> for ParameterError
+{
+ fn from(err: DeserializerError) -> Self
+ {
+ DeserializationError(err).into()
+ }
}
fn deserialize_type<Err>(deserializer: &mut impl Deserializer) -> Result<String, Err>