aboutsummaryrefslogtreecommitdiff
path: root/src/primitive/string.rs
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2021-01-04 18:38:31 +0100
committerMax Audron <audron@cocaine.farm>2021-01-04 18:38:31 +0100
commit0b7c6cf0b129799110d3ef0118e1f2b5697a2068 (patch)
tree9bbb49c7af7feb6fc1aff497e0d577fe31ef11ed /src/primitive/string.rs
parentWIP: function api (diff)
parentadd example program: quasselproxy (diff)
Merge branch 'client'
Diffstat (limited to 'src/primitive/string.rs')
-rw-r--r--src/primitive/string.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/primitive/string.rs b/src/primitive/string.rs
index 86bcdec..dcd4f7c 100644
--- a/src/primitive/string.rs
+++ b/src/primitive/string.rs
@@ -7,8 +7,8 @@ use failure::Error;
use log::trace;
-use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8};
use crate::util;
+use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8};
/// We Shadow the String type here as we can only use impl on types in our own scope.
///
@@ -33,7 +33,6 @@ impl SerializeUTF8 for String {
fn serialize_utf8(&self) -> Result<Vec<u8>, Error> {
let mut res: Vec<u8> = Vec::new();
res.extend(self.clone().into_bytes());
- res.extend(vec![0x00]);
util::prepend_byte_len(&mut res);
return Ok(res);
}
@@ -64,6 +63,7 @@ impl Deserialize for String {
}
let res: String = String::from_utf16(&chars).unwrap();
+ trace!("parsed string: {}", res);
return Ok((pos, res));
}
}
@@ -81,6 +81,7 @@ impl DeserializeUTF8 for String {
let ulen = len as usize;
let mut res: String = String::from_utf8(b[4..(ulen + 4)].to_vec())?;
+ trace!("parsed string: {}", res);
// If the last byte is zero remove it
// Receiving a string as bytearray will sometimes have
@@ -89,6 +90,8 @@ impl DeserializeUTF8 for String {
let _ = res.pop();
}
+ trace!("parsed string after trunc: {}", res);
+
return Ok((ulen + 4, res));
}
}