pub struct InMemoryStore { /* private fields */ }Expand description
Implementations§
Source§impl InMemoryStore
impl InMemoryStore
Sourcepub fn with_mailbox(self, id: i64, name: &str) -> Self
pub fn with_mailbox(self, id: i64, name: &str) -> Self
Append a mailbox with the given id and name.
Sourcepub fn with_message(self, msg: Message) -> Self
pub fn with_message(self, msg: Message) -> Self
Append a pre-built Message. Use make_message for a sane default
shape and mutate before passing in if you need overrides.
Sourcepub fn with_message_raw(self, msg_id: i64, raw: Vec<u8>) -> Self
pub fn with_message_raw(self, msg_id: i64, raw: Vec<u8>) -> Self
Map a message id to raw RFC 5322 bytes. MailStore::read_message_raw
returns these bytes; without this setter that method returns None.
Sourcepub fn with_parsed_body(self, raw: Vec<u8>, parsed: ParsedBody) -> Self
pub fn with_parsed_body(self, raw: Vec<u8>, parsed: ParsedBody) -> Self
Map a specific raw byte sequence to a parsed body. The store’s
MailStore::parse_message returns the override when called with
matching bytes, and ParsedBody::default() otherwise.
Sourcepub fn with_mailbox_counts(self, mb_id: i64, counts: MailboxCounts) -> Self
pub fn with_mailbox_counts(self, mb_id: i64, counts: MailboxCounts) -> Self
Override mailbox counts for a specific mailbox id. Without this the store derives total/unread from the message list.
Sourcepub fn list_mailboxes_fails(self, msg: &str) -> Self
pub fn list_mailboxes_fails(self, msg: &str) -> Self
Make MailStore::list_mailboxes return an error carrying msg.
Sourcepub fn mailbox_status_fails(self, msg: &str) -> Self
pub fn mailbox_status_fails(self, msg: &str) -> Self
Make MailStore::mailbox_status return an error carrying msg.
Sourcepub fn list_messages_fails(self, msg: &str) -> Self
pub fn list_messages_fails(self, msg: &str) -> Self
Make MailStore::list_messages return an error carrying msg.
Sourcepub fn get_message_fails(self, msg: &str) -> Self
pub fn get_message_fails(self, msg: &str) -> Self
Make MailStore::get_message_by_db_id return an error carrying msg.
Sourcepub fn list_thread_messages_fails(self, msg: &str) -> Self
pub fn list_thread_messages_fails(self, msg: &str) -> Self
Make MailStore::list_thread_messages return an error carrying msg.
Sourcepub fn update_flags_fails(self, msg: &str) -> Self
pub fn update_flags_fails(self, msg: &str) -> Self
Make MailStore::update_flags return an error carrying msg.
Sourcepub fn add_flags_fails(self, msg: &str) -> Self
pub fn add_flags_fails(self, msg: &str) -> Self
Make MailStore::add_flags return an error carrying msg.
Sourcepub fn submission_fails_with(self, msg: &str) -> Self
pub fn submission_fails_with(self, msg: &str) -> Self
Configure MailStore::submit_message to fail with a description.
Sourcepub fn submission_fails_silently(self) -> Self
pub fn submission_fails_silently(self) -> Self
Configure MailStore::submit_message to fail without a description.
Trait Implementations§
Source§impl Default for InMemoryStore
impl Default for InMemoryStore
Source§impl MailStore for InMemoryStore
impl MailStore for InMemoryStore
Source§fn list_mailboxes<'life0, 'life1, 'async_trait>(
&'life0 self,
_user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Mailbox>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_mailboxes<'life0, 'life1, 'async_trait>(
&'life0 self,
_user: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Mailbox>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
user. Used by Mailbox/get and Mailbox/query.Source§fn mailbox_status<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
) -> Pin<Box<dyn Future<Output = Result<MailboxCounts, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mailbox_status<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
) -> Pin<Box<dyn Future<Output = Result<MailboxCounts, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
(total, unread) for a mailbox. May be best-effort: handlers
fall back to (0, 0) on error.Source§fn list_messages<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
offset: u32,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_messages<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
offset: u32,
limit: u32,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
limit messages in mailbox_id starting at offset,
ordered however the store deems natural (typically by uid).Source§fn get_message_by_db_id<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_message_by_db_id<'life0, 'life1, 'async_trait>(
&'life0 self,
user: &'life1 str,
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Message>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ok(None) when
the id exists but doesn’t belong to user, or when no such id exists.Source§fn list_thread_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
thread_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn list_thread_messages<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
thread_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
thread_id for user, ordered chronologically.Source§fn update_flags<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
uid: u32,
flags: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_flags<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
uid: u32,
flags: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
mailbox_id + uid identify the row.Source§fn add_flags<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
uid: u32,
flags: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_flags<'life0, 'async_trait>(
&'life0 self,
mailbox_id: i64,
uid: u32,
flags: u32,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
flags into the message’s flag bitmask. Used to set \Deleted.Source§fn read_message_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_message_raw<'life0, 'life1, 'async_trait>(
&'life0 self,
message: &'life1 Message,
) -> Pin<Box<dyn Future<Output = Option<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
None when not
available (e.g. blob missing on disk). Used to populate bodyValues,
textBody, htmlBody, and the submission path.Source§fn parse_message(&self, raw: &[u8]) -> ParsedBody
fn parse_message(&self, raw: &[u8]) -> ParsedBody
Self::read_message_raw so the same bytes can serve both
Email/get rendering and EmailSubmission/set outbound delivery.