diff options
| author | Max Audron <audron@cocaine.farm> | 2021-04-05 18:03:46 +0200 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2021-04-05 18:03:46 +0200 |
| commit | d7488b8040278c2cf9cd1b1eead206efe408cd9f (patch) | |
| tree | 1188190a730e6c0d4277c588545c5ff557afb3cd /src/primitive/string.rs | |
| parent | WIP: impl signalproxy types (diff) | |
WIP: impl more signalproxy objects
Diffstat (limited to 'src/primitive/string.rs')
| -rw-r--r-- | src/primitive/string.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/primitive/string.rs b/src/primitive/string.rs index 7ea838d..478bc0a 100644 --- a/src/primitive/string.rs +++ b/src/primitive/string.rs @@ -8,9 +8,7 @@ use failure::Error; use log::trace; use crate::util; -use crate::{Deserialize, DeserializeUTF8, Serialize, SerializeUTF8}; - -pub type ByteArray = String; +use crate::{deserialize::*, serialize::*}; /// We Shadow the String type here as we can only use impl on types in our own scope. /// @@ -21,10 +19,8 @@ impl Serialize for String { fn serialize(&self) -> Result<Vec<u8>, Error> { let mut res: Vec<u8> = Vec::new(); - let utf16: Vec<u16> = self.encode_utf16().collect(); - for i in utf16 { - res.extend(i.to_be_bytes().iter()); - } + self.encode_utf16() + .for_each(|i| res.extend(i.to_be_bytes().iter())); util::prepend_byte_len(&mut res); return Ok(res); |
