From d51d0187a6a7cbd5b0a4aed4f4c498b503e3ee4a Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Tue, 13 Oct 2020 21:46:03 +0300 Subject: [PATCH] melib/imap: change byte cache String -> Vec --- melib/src/backends/imap.rs | 4 +--- melib/src/backends/imap/operations.rs | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/melib/src/backends/imap.rs b/melib/src/backends/imap.rs index 07704f4d..f5851430 100644 --- a/melib/src/backends/imap.rs +++ b/melib/src/backends/imap.rs @@ -82,9 +82,7 @@ pub static SUPPORTED_CAPABILITIES: &[&str] = &[ #[derive(Debug, Default)] pub struct EnvelopeCache { - bytes: Option, - headers: Option, - body: Option, + bytes: Option>, flags: Option, } diff --git a/melib/src/backends/imap/operations.rs b/melib/src/backends/imap/operations.rs index d1a6cfdb..d0db6cd6 100644 --- a/melib/src/backends/imap/operations.rs +++ b/melib/src/backends/imap/operations.rs @@ -103,12 +103,11 @@ impl BackendOp for ImapOp { //flags.lock().await.set(Some(_flags)); cache.flags = Some(_flags); } - cache.bytes = - Some(unsafe { std::str::from_utf8_unchecked(body.unwrap()).to_string() }); + cache.bytes = Some(body.unwrap().to_vec()); } let mut bytes_cache = uid_store.byte_cache.lock()?; let cache = bytes_cache.entry(uid).or_default(); - let ret = cache.bytes.clone().unwrap().into_bytes(); + let ret = cache.bytes.clone().unwrap(); Ok(ret) })) }