email/maildir/
config.rs

1//! Module dedicated to the Maildir backend configuration.
2//!
3//! This module contains the configuration specific to the Maildir
4//! backend.
5
6use std::path::PathBuf;
7
8/// The Maildir backend configuration.
9#[derive(Debug, Default, Clone, Eq, PartialEq)]
10#[cfg_attr(
11    feature = "derive",
12    derive(serde::Serialize, serde::Deserialize),
13    serde(rename_all = "kebab-case")
14)]
15pub struct MaildirConfig {
16    /// The Maildir root directory.
17    ///
18    /// The path should point to the root level of the Maildir
19    /// directory (the one containing the `cur`, `new` and `tmp`
20    /// folders). Path is shell-expanded, which means environment
21    /// variables and tilde `~` are replaced by their values.
22    pub root_dir: PathBuf,
23
24    #[cfg_attr(feature = "derive", serde(default))]
25    pub maildirpp: bool,
26}
27
28#[cfg(feature = "sync")]
29impl crate::sync::hash::SyncHash for MaildirConfig {
30    fn sync_hash(&self, state: &mut std::hash::DefaultHasher) {
31        std::hash::Hash::hash(&shellexpand_utils::shellexpand_path(&self.root_dir), state);
32    }
33}