diff options
Diffstat (limited to 'src/primitive')
| -rw-r--r-- | src/primitive/bufferinfo.rs | 1 | ||||
| -rw-r--r-- | src/primitive/string.rs | 2 | ||||
| -rw-r--r-- | src/primitive/variant.rs | 6 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/primitive/bufferinfo.rs b/src/primitive/bufferinfo.rs index 1c4e206..24080cb 100644 --- a/src/primitive/bufferinfo.rs +++ b/src/primitive/bufferinfo.rs @@ -42,6 +42,7 @@ impl Deserialize for BufferInfo { // There are 4 additional undocumented Bytes in the BufferInfo // so we start at byte 14 + // TODO is groupid let (size, name) = String::parse_utf8(&b[14..])?; return Ok(( diff --git a/src/primitive/string.rs b/src/primitive/string.rs index 590c529..7ea838d 100644 --- a/src/primitive/string.rs +++ b/src/primitive/string.rs @@ -10,6 +10,8 @@ use log::trace; use crate::util; use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8}; +pub type ByteArray = String; + /// We Shadow the String type here as we can only use impl on types in our own scope. /// /// Strings are serialized as an i32 for the length in bytes, then the chars represented in UTF-16 in bytes. diff --git a/src/primitive/variant.rs b/src/primitive/variant.rs index e9e032e..8a98d59 100644 --- a/src/primitive/variant.rs +++ b/src/primitive/variant.rs @@ -12,6 +12,8 @@ use crate::{Serialize, SerializeUTF8}; use crate::primitive::{BufferInfo, Date, DateTime, Message, Time, VariantList, VariantMap}; +use libquassel_derive::From; + /// Variant represents the possible types we can receive /// /// Variant's are serizalized as the Type as a i32 and then the Type in it's own format @@ -21,9 +23,10 @@ use crate::primitive::{BufferInfo, Date, DateTime, Message, Time, VariantList, V /// /// ByteArray is de-/serialized as a C ByteArray. #[allow(non_camel_case_types, dead_code)] -#[derive(Clone, Debug, std::cmp::PartialEq)] +#[derive(Clone, Debug, PartialEq, From)] pub enum Variant { Unknown, + #[from(ignore)] UserType(String, Vec<u8>), BufferInfo(BufferInfo), Message(Message), @@ -33,6 +36,7 @@ pub enum Variant { VariantMap(VariantMap), VariantList(VariantList), String(String), + #[from(ignore)] ByteArray(String), StringList(StringList), bool(bool), |
