Struct Maildir

Source
pub struct Maildir {
    root: PathBuf,
    cur: PathBuf,
    new: PathBuf,
    tmp: PathBuf,
    info_separator: &'static str,
}
Expand description

The mail directory.

A Maildir is a mail directory composed of a new, cur and tmp subdirectories.

Fields§

§root: PathBuf

The root path of the mail directory.

§cur: PathBuf§new: PathBuf§tmp: PathBuf§info_separator: &'static str

The Maildir entry id ←→ info separator.

Implementations§

Source§

impl Maildir

Source

pub fn set_info_separator(&mut self, sep: &'static str)

Source

pub fn with_info_separator(self, sep: &'static str) -> Self

Source

pub fn path(&self) -> &Path

Source

pub fn name(&self) -> Result<&str>

Source

pub fn cur(&self) -> &Path

Source

pub fn new(&self) -> &Path

Source

pub fn tmp(&self) -> &Path

Source

pub fn exists(&self) -> bool

Source

pub fn create(&self) -> Result<()>

Source

pub fn create_all(&self) -> Result<()>

Source

pub fn remove(&self) -> Result<()>

Removes the cur, new and tmp directories from the current Maildir.

This function does not remove the root directory. If you want to do so, see Maildir::remove_all.

Source

pub fn remove_all(&self) -> Result<()>

Removes the current Maildir.

This function removes the cur, new and tmp directories as well as the root directory of the current Maildir. See also Maildir::remove.

Source

pub fn read(&self) -> Result<impl Iterator<Item = MaildirEntry> + '_>

Source

pub fn find(&self, id: impl AsRef<str>) -> Result<Option<MaildirEntry>>

Source

pub fn get(&self, id: impl AsRef<str>) -> Result<MaildirEntry>

Source

pub fn write_new(&self, contents: impl AsRef<[u8]>) -> Result<MaildirEntry>

Source

pub fn write_cur( &self, contents: impl AsRef<[u8]>, flags: impl IntoIterator<Item = Flag>, ) -> Result<MaildirEntry>

Source

fn write( &self, contents: impl AsRef<[u8]>, flags: impl IntoIterator<Item = Flag>, new: bool, id: Option<String>, ) -> Result<MaildirEntry>

Source

fn format_file_name(&self, id: String, flags: HashSet<Flag>) -> String

Trait Implementations§

Source§

impl Clone for Maildir

Source§

fn clone(&self) -> Maildir

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Maildir

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Into<PathBuf>> From<P> for Maildir

Source§

fn from(root: P) -> Self

Converts to this type from the input type.
Source§

impl Hash for Maildir

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Maildir

Source§

fn eq(&self, other: &Maildir) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Maildir

Source§

impl StructuralPartialEq for Maildir

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.