Skip to main content

M2dirClient

Struct M2dirClient 

Source
pub struct M2dirClient {
    pub inner: M2dirClient,
}
Available on crate features 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: M2dirClient

Implementations§

Source§

impl M2dirClient

Source

pub fn new(root: impl Into<M2dirPath>) -> Self

Wraps a fresh inner client rooted at root. No filesystem check is performed at construction time.

Source

pub fn run<C, T, E>(&self, coroutine: C) -> Result<T, M2dirClientError>
where C: M2dirCoroutine<Yield = M2dirYield, Return = Result<T, E>>, M2dirClientError: From<E>,

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.

Source

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.

Source

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.

Source

pub 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.

Searches envelopes in mailbox against the shared query. Filtering and sorting happen client-side after a full scan.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn delete_mailbox(&self, name: &str) -> Result<(), M2dirClientError>

Recursively removes the m2dir at name.

Source

pub fn delete_message( &self, mailbox: &str, id: &str, ) -> Result<(), M2dirClientError>

Removes the entry id and every matching .meta/<id>* file.

Source

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.

Source

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

Source§

type Proj<U: 'src> = U

Source§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

Source§

impl<T, S> SpanWrap<S> for T
where S: WrappingSpan<T>,

Source§

fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned

Invokes WrappingSpan::make_wrapped to wrap an AST node in a span.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.