aboutsummaryrefslogtreecommitdiff
path: root/src/deserialize.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/deserialize.rs')
-rw-r--r--src/deserialize.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/deserialize.rs b/src/deserialize.rs
new file mode 100644
index 0000000..e13f21f
--- /dev/null
+++ b/src/deserialize.rs
@@ -0,0 +1,21 @@
+use crate::error::ProtocolError;
+
+/// Deserialization of types and structs to the quassel byteprotocol
+pub trait Deserialize {
+ fn parse(b: &[u8]) -> Result<(usize, Self), ProtocolError>
+ where
+ Self: std::marker::Sized;
+}
+
+/// Deserialization of UTF-8 based Strings to the quassel byteprotocol
+pub trait DeserializeUTF8 {
+ fn parse_utf8(b: &[u8]) -> Result<(usize, Self), ProtocolError>
+ where
+ Self: std::marker::Sized;
+}
+
+pub trait DeserializeVariant {
+ fn parse_variant(b: &[u8]) -> Result<(usize, Self), ProtocolError>
+ where
+ Self: std::marker::Sized;
+}