pub struct M2dirClient {
pub inner: M2dirClient,
}client and m2dir only.Expand description
Light m2dir client wrapping a filesystem root.
The shared root lives on Self::inner; m2dir has no extra
per-session knobs (no auto_select, no capability list).
Fields§
§inner: M2dirClientImplementations§
Source§impl M2dirClient
impl M2dirClient
Sourcepub fn new(root: impl Into<M2dirPath>) -> Self
pub fn new(root: impl Into<M2dirPath>) -> Self
Wraps a fresh inner client rooted at root. No filesystem
check is performed at construction time.
Sourcepub fn run<C, T, E>(&self, coroutine: C) -> Result<T, M2dirClientError>
pub fn run<C, T, E>(&self, coroutine: C) -> Result<T, M2dirClientError>
Pumps any standard-shape m2dir coroutine
(Yield = M2dirYield, Return = Result<T, E>) against the
local filesystem until it terminates.
Duplicates the body of InnerM2dirClient::run so error
variants route through M2dirClientError directly.
Sourcepub fn list_mailboxes(
&self,
with_counts: bool,
) -> Result<Vec<Mailbox>, M2dirClientError>
pub fn list_mailboxes( &self, with_counts: bool, ) -> Result<Vec<Mailbox>, M2dirClientError>
Lists every m2dir under the store root. with_counts is
accepted for symmetry with the other backends; surfacing
totals/unread needs a follow-up walk and is currently a no-op.
Sourcepub fn list_envelopes(
&self,
mailbox: &str,
page: Option<u32>,
page_size: Option<u32>,
with_attachment: bool,
) -> Result<Vec<Envelope>, M2dirClientError>
pub fn list_envelopes( &self, mailbox: &str, page: Option<u32>, page_size: Option<u32>, with_attachment: bool, ) -> Result<Vec<Envelope>, M2dirClientError>
Lists envelopes from mailbox. page = None and
page_size = None fetch the whole mailbox; envelopes are
sorted by date descending.
Sourcepub fn search_envelopes(
&self,
mailbox: &str,
query: Option<&SearchEmailsQuery>,
page: Option<u32>,
page_size: Option<u32>,
with_attachment: bool,
) -> Result<Vec<Envelope>, M2dirClientError>
Available on crate feature search only.
pub fn search_envelopes( &self, mailbox: &str, query: Option<&SearchEmailsQuery>, page: Option<u32>, page_size: Option<u32>, with_attachment: bool, ) -> Result<Vec<Envelope>, M2dirClientError>
search only.Searches envelopes in mailbox against the shared query.
Filtering and sorting happen client-side after a full scan.
Sourcepub fn store_flags(
&self,
mailbox: &str,
ids: &[&str],
flags: &[Flag],
op: FlagOp,
) -> Result<(), M2dirClientError>
pub fn store_flags( &self, mailbox: &str, ids: &[&str], flags: &[Flag], op: FlagOp, ) -> Result<(), M2dirClientError>
Adds, sets, or removes flags on every id by rewriting each
.meta/<id>.flags sidecar.
Sourcepub fn get_message(
&self,
mailbox: &str,
id: &str,
) -> Result<Vec<u8>, M2dirClientError>
pub fn get_message( &self, mailbox: &str, id: &str, ) -> Result<Vec<u8>, M2dirClientError>
Reads one message’s raw bytes by id, validating the checksum embedded in its filename.
Sourcepub fn add_message(
&self,
mailbox: &str,
flags: &[Flag],
raw: Vec<u8>,
) -> Result<String, M2dirClientError>
pub fn add_message( &self, mailbox: &str, flags: &[Flag], raw: Vec<u8>, ) -> Result<String, M2dirClientError>
Appends raw to mailbox, then persists flags as the
.meta/<id>.flags sidecar when non-empty. Returns the minted
entry id.
Sourcepub fn create_mailbox(&self, name: &str) -> Result<(), M2dirClientError>
pub fn create_mailbox(&self, name: &str) -> Result<(), M2dirClientError>
Creates name as a new m2dir mailbox: the folder, the
.m2dir marker and the .meta sub-directory.
Sourcepub fn delete_mailbox(&self, name: &str) -> Result<(), M2dirClientError>
pub fn delete_mailbox(&self, name: &str) -> Result<(), M2dirClientError>
Recursively removes the m2dir at name.
Sourcepub fn delete_message(
&self,
mailbox: &str,
id: &str,
) -> Result<(), M2dirClientError>
pub fn delete_message( &self, mailbox: &str, id: &str, ) -> Result<(), M2dirClientError>
Removes the entry id and every matching .meta/<id>* file.
Sourcepub fn copy_messages(
&self,
from: &str,
to: &str,
ids: &[&str],
) -> Result<(), M2dirClientError>
pub fn copy_messages( &self, from: &str, to: &str, ids: &[&str], ) -> Result<(), M2dirClientError>
Copies every id from from to to. Flag sidecars are not
propagated; callers add flags explicitly after the copy when
needed.
Sourcepub fn move_messages(
&self,
from: &str,
to: &str,
ids: &[&str],
) -> Result<(), M2dirClientError>
pub fn move_messages( &self, from: &str, to: &str, ids: &[&str], ) -> Result<(), M2dirClientError>
Moves every id from from to to. Flag sidecars are not
propagated; callers add flags explicitly after the move when
needed.
Auto Trait Implementations§
impl Freeze for M2dirClient
impl RefUnwindSafe for M2dirClient
impl Send for M2dirClient
impl Sync for M2dirClient
impl Unpin for M2dirClient
impl UnsafeUnpin for M2dirClient
impl UnwindSafe for M2dirClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.