[−][src]Struct maildir::Maildir
The main entry point for this library. This struct can be
instantiated from a path using the from
implementations.
The path passed in to the from
should be the root of the
maildir (the folder containing cur
, new
, and tmp
).
Methods
impl Maildir
[src]
pub fn path(&self) -> &Path
[src]
Returns the path of the maildir base folder.
pub fn count_new(&self) -> usize
[src]
Returns the number of messages found inside the new
maildir folder.
pub fn count_cur(&self) -> usize
[src]
Returns the number of messages found inside the cur
maildir folder.
ⓘImportant traits for MailEntriespub fn list_new(&self) -> MailEntries
[src]
Returns an iterator over the messages inside the new
maildir folder. The order of messages in the iterator
is not specified, and is not guaranteed to be stable
over multiple invocations of this method.
ⓘImportant traits for MailEntriespub fn list_cur(&self) -> MailEntries
[src]
Returns an iterator over the messages inside the cur
maildir folder. The order of messages in the iterator
is not specified, and is not guaranteed to be stable
over multiple invocations of this method.
pub fn move_new_to_cur(&self, id: &str) -> Result<()>
[src]
Moves a message from the new
maildir folder to the
cur
maildir folder. The id passed in should be
obtained from the iterator produced by list_new
.
pub fn move_new_to_cur_with_flags(&self, id: &str, flags: &str) -> Result<()>
[src]
Moves a message from the new
maildir folder to the cur
maildir folder, and sets the
given flags. The id passed in should be obtained from the iterator produced by list_new
.
The possible flags are described e.g. at https://cr.yp.to/proto/maildir.html or http://www.courier-mta.org/maildir.html.
pub fn find(&self, id: &str) -> Option<MailEntry>
[src]
Tries to find the message with the given id in the
maildir. This searches both the new
and the cur
folders.
pub fn delete(&self, id: &str) -> Result<()>
[src]
pub fn create_dirs(&self) -> Result<()>
[src]
Creates all neccessary directories if they don't exist yet. It is the library user's
responsibility to call this before using store_new
.
pub fn store_new(&self, data: &[u8]) -> Result<String, MaildirError>
[src]
Stores the given message data as a new message file in the Maildir new
folder. Does not
create the neccessary directories, so if in doubt call create_dirs
before using
store_new
.
Returns the Id of the inserted message on success.
pub fn store_cur_with_flags(
&self,
data: &[u8],
flags: &str
) -> Result<String, MaildirError>
[src]
&self,
data: &[u8],
flags: &str
) -> Result<String, MaildirError>
Stores the given message data as a new message file in the Maildir cur
folder, adding the
given flags
to it. The possible flags are explained e.g. at
https://cr.yp.to/proto/maildir.html or http://www.courier-mta.org/maildir.html.
Returns the Id of the inserted message on success.
Trait Implementations
impl From<PathBuf> for Maildir
[src]
impl From<String> for Maildir
[src]
impl<'a> From<&'a str> for Maildir
[src]
Auto Trait Implementations
impl Send for Maildir
impl Sync for Maildir
impl Unpin for Maildir
impl UnwindSafe for Maildir
impl RefUnwindSafe for Maildir
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,