BackendOp: remove description() method
parent
e06308fed2
commit
ed3e66cedf
|
@ -425,9 +425,6 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
||||||
/// struct FooOp {}
|
/// struct FooOp {}
|
||||||
///
|
///
|
||||||
/// impl BackendOp for FooOp {
|
/// impl BackendOp for FooOp {
|
||||||
/// fn description(&self) -> String {
|
|
||||||
/// "Foobar".to_string()
|
|
||||||
/// }
|
|
||||||
/// fn as_bytes(&mut self) -> Result<&[u8]> {
|
/// fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
/// unimplemented!()
|
/// unimplemented!()
|
||||||
/// }
|
/// }
|
||||||
|
@ -437,10 +434,8 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync {
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let operation = Box::new(FooOp {});
|
/// let operation = Box::new(FooOp {});
|
||||||
/// assert_eq!("Foobar", &operation.description());
|
|
||||||
/// ```
|
/// ```
|
||||||
pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send {
|
pub trait BackendOp: ::std::fmt::Debug + ::std::marker::Send {
|
||||||
fn description(&self) -> String;
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]>;
|
fn as_bytes(&mut self) -> Result<&[u8]>;
|
||||||
fn fetch_flags(&self) -> Result<Flag>;
|
fn fetch_flags(&self) -> Result<Flag>;
|
||||||
fn set_flag(
|
fn set_flag(
|
||||||
|
@ -471,9 +466,6 @@ impl ReadOnlyOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for ReadOnlyOp {
|
impl BackendOp for ReadOnlyOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
format!("read-only: {}", self.op.description())
|
|
||||||
}
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
self.op.as_bytes()
|
self.op.as_bytes()
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,6 @@ impl ImapOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for ImapOp {
|
impl BackendOp for ImapOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
format!("Message in mailbox: {}", &self.mailbox_path)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
if self.bytes.is_none() {
|
if self.bytes.is_none() {
|
||||||
let mut bytes_cache = self.uid_store.byte_cache.lock()?;
|
let mut bytes_cache = self.uid_store.byte_cache.lock()?;
|
||||||
|
|
|
@ -64,10 +64,6 @@ impl ImapOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for ImapOp {
|
impl BackendOp for ImapOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
format!("Message in mailbox: {}", &self.mailbox_path)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
if self.bytes.is_none() {
|
if self.bytes.is_none() {
|
||||||
let mut bytes_cache = self.uid_store.byte_cache.lock()?;
|
let mut bytes_cache = self.uid_store.byte_cache.lock()?;
|
||||||
|
|
|
@ -57,13 +57,6 @@ impl JmapOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for JmapOp {
|
impl BackendOp for JmapOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
self.store
|
|
||||||
.try_read()
|
|
||||||
.and_then(|store_lck| Ok(store_lck.id_store[&self.hash].clone()))
|
|
||||||
.unwrap_or(String::new())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
if self.bytes.is_none() {
|
if self.bytes.is_none() {
|
||||||
let mut store_lck = self.store.write().unwrap();
|
let mut store_lck = self.store.write().unwrap();
|
||||||
|
|
|
@ -90,9 +90,6 @@ impl MaildirOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BackendOp for MaildirOp {
|
impl<'a> BackendOp for MaildirOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
format!("Path of file: {}", self.path().display())
|
|
||||||
}
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
if self.slice.is_none() {
|
if self.slice.is_none() {
|
||||||
self.slice = Some(Mmap::open_path(self.path(), Protection::Read)?);
|
self.slice = Some(Mmap::open_path(self.path(), Protection::Read)?);
|
||||||
|
|
|
@ -182,10 +182,6 @@ impl MboxOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for MboxOp {
|
impl BackendOp for MboxOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
if self.slice.is_none() {
|
if self.slice.is_none() {
|
||||||
self.slice = Some(Mmap::open_path(&self.path, Protection::Read)?);
|
self.slice = Some(Mmap::open_path(&self.path, Protection::Read)?);
|
||||||
|
|
|
@ -646,10 +646,6 @@ struct NotmuchOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for NotmuchOp {
|
impl BackendOp for NotmuchOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
let mut message: *mut notmuch_message_t = std::ptr::null_mut();
|
let mut message: *mut notmuch_message_t = std::ptr::null_mut();
|
||||||
let index_lck = self.index.write().unwrap();
|
let index_lck = self.index.write().unwrap();
|
||||||
|
|
|
@ -297,10 +297,6 @@ struct PluginOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BackendOp for PluginOp {
|
impl BackendOp for PluginOp {
|
||||||
fn description(&self) -> String {
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn as_bytes(&mut self) -> Result<&[u8]> {
|
fn as_bytes(&mut self) -> Result<&[u8]> {
|
||||||
if let Some(ref bytes) = self.bytes {
|
if let Some(ref bytes) = self.bytes {
|
||||||
return Ok(bytes.as_bytes());
|
return Ok(bytes.as_bytes());
|
||||||
|
|
Loading…
Reference in New Issue