melib/imap: change byte cache String -> Vec<u8>
parent
2944fc992b
commit
d51d0187a6
|
@ -82,9 +82,7 @@ pub static SUPPORTED_CAPABILITIES: &[&str] = &[
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct EnvelopeCache {
|
pub struct EnvelopeCache {
|
||||||
bytes: Option<String>,
|
bytes: Option<Vec<u8>>,
|
||||||
headers: Option<String>,
|
|
||||||
body: Option<String>,
|
|
||||||
flags: Option<Flag>,
|
flags: Option<Flag>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,12 +103,11 @@ impl BackendOp for ImapOp {
|
||||||
//flags.lock().await.set(Some(_flags));
|
//flags.lock().await.set(Some(_flags));
|
||||||
cache.flags = Some(_flags);
|
cache.flags = Some(_flags);
|
||||||
}
|
}
|
||||||
cache.bytes =
|
cache.bytes = Some(body.unwrap().to_vec());
|
||||||
Some(unsafe { std::str::from_utf8_unchecked(body.unwrap()).to_string() });
|
|
||||||
}
|
}
|
||||||
let mut bytes_cache = uid_store.byte_cache.lock()?;
|
let mut bytes_cache = uid_store.byte_cache.lock()?;
|
||||||
let cache = bytes_cache.entry(uid).or_default();
|
let cache = bytes_cache.entry(uid).or_default();
|
||||||
let ret = cache.bytes.clone().unwrap().into_bytes();
|
let ret = cache.bytes.clone().unwrap();
|
||||||
Ok(ret)
|
Ok(ret)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue