From d7488b8040278c2cf9cd1b1eead206efe408cd9f Mon Sep 17 00:00:00 2001 From: Max Audron Date: Mon, 5 Apr 2021 18:03:46 +0200 Subject: WIP: impl more signalproxy objects --- src/primitive/string.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/primitive/string.rs') 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, Error> { let mut res: Vec = Vec::new(); - let utf16: Vec = 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); -- cgit v1.2.3