pub struct MailEntry { /* private fields */ }Expand description
A struct representing a single email message inside the maildir.
No parsing is done. This struct only holds the path to the message file,
and handles file system operations. The struct can only be created by
methods in Maildir.
Implementations§
Source§impl MailEntry
impl MailEntry
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Create a new MailEntry from a path.
§Errors
Will error if the path does not contain a file name part.
Sourcepub fn set_id<S: ToString>(&mut self, id: S) -> Result<(), Error>
pub fn set_id<S: ToString>(&mut self, id: S) -> Result<(), Error>
Set the unique identifier of the email message.
This also updates the path to the email message and renames the file on the file system.
§Errors
This method will return an error if the new ID is invalid or if there was an error renaming the file on the file system.
Sourcepub fn to_path_buf(self) -> PathBuf
pub fn to_path_buf(self) -> PathBuf
Sourcepub fn move_to_new(&mut self) -> Result<(), Error>
pub fn move_to_new(&mut self) -> Result<(), Error>
Moves the email message to the new directory.
Sourcepub fn move_to_cur(&mut self) -> Result<(), Error>
pub fn move_to_cur(&mut self) -> Result<(), Error>
Moves the email message to the cur directory.
Sourcepub fn move_to_tmp(&mut self) -> Result<(), Error>
pub fn move_to_tmp(&mut self) -> Result<(), Error>
Moves the email message to the tmp directory.
Sourcepub fn flags_to_string(&self) -> String
pub fn flags_to_string(&self) -> String
Get the flags of the email message as a string.
Sourcepub fn set_flag(&mut self, flag: Flag) -> Result<(), Error>
pub fn set_flag(&mut self, flag: Flag) -> Result<(), Error>
Set a flag on the email message.
This also updates the path to the email message and renames the file on the file system.
§Errors
This method will return an error if there was an error renaming the file.
Sourcepub fn unset_flag(&mut self, flag: Flag) -> Result<(), Error>
pub fn unset_flag(&mut self, flag: Flag) -> Result<(), Error>
Unset a flag on the email message.
This also updates the path to the email message and renames the file on the file system.
§Errors
This method will return an error if there was an error renaming the file.