pub trait BackendOp: Debug + Send {
// Required method
fn as_bytes(&mut self) -> ResultFuture<Vec<u8>>;
}
Expand description
A BackendOp
manages common operations for the various mail backends. They
only live for the duration of the operation. They are generated by the
operation
method of Mailbackend
trait.
§Motivation
We need a way to do various operations on individual mails regardless of what backend they come from (eg local or imap).
§Creation
ⓘ
/* Create operation from Backend */
let op = backend.operation(message.hash(), mailbox.hash());
§Example
ⓘ
use melib::backends::{BackendOp};
use melib::Result;
use melib::{Envelope, Flag};
#[derive(Debug)]
struct FooOp {}
impl BackendOp for FooOp {
fn as_bytes(&mut self) -> Result<&[u8]> {
unimplemented!()
}
}
let operation = Box::new(FooOp {});