Struct mailpot::Configuration
source · pub struct Configuration {
pub send_mail: SendMail,
pub db_path: PathBuf,
pub data_path: PathBuf,
pub administrators: Vec<String>,
}
Expand description
The configuration for the mailpot database and the mail server.
Fields§
§send_mail: SendMail
How to send e-mail.
db_path: PathBuf
The location of the sqlite3 file.
data_path: PathBuf
The directory where data are stored.
administrators: Vec<String>
Instance administrators (List of e-mail addresses). Optional.
Implementations§
source§impl Configuration
impl Configuration
sourcepub fn new(db_path: impl Into<PathBuf>) -> Self
pub fn new(db_path: impl Into<PathBuf>) -> Self
Create a new configuration value from a given database path value.
If you wish to create a new database with this configuration, use
Connection::open_or_create_db
.
To open an existing database, use
Database::open_db
.
sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Deserialize configuration from TOML file.
sourcepub fn data_directory(&self) -> &Path
pub fn data_directory(&self) -> &Path
The saved data path.
sourcepub fn save_message_to_path(&self, msg: &str, path: PathBuf) -> Result<PathBuf>
pub fn save_message_to_path(&self, msg: &str, path: PathBuf) -> Result<PathBuf>
Save message to a custom path.
sourcepub fn save_message(&self, msg: String) -> Result<PathBuf>
pub fn save_message(&self, msg: String) -> Result<PathBuf>
Save message to the data directory.
Trait Implementations§
source§impl Clone for Configuration
impl Clone for Configuration
source§fn clone(&self) -> Configuration
fn clone(&self) -> Configuration
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Configuration
impl Debug for Configuration
source§impl<'de> Deserialize<'de> for Configuration
impl<'de> Deserialize<'de> for Configuration
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more