pub struct AccountConfig {
Show 20 fields pub name: String, pub email: String, pub display_name: Option<String>, pub signature_delim: Option<String>, pub signature: Option<String>, pub downloads_dir: Option<PathBuf>, pub folder_listing_page_size: Option<usize>, pub folder_aliases: HashMap<String, String>, pub email_listing_page_size: Option<usize>, pub email_listing_datetime_fmt: Option<String>, pub email_listing_datetime_local_tz: Option<bool>, pub email_reading_headers: Option<Vec<String>>, pub email_reading_format: EmailTextPlainFormat, pub email_writing_headers: Option<Vec<String>>, pub email_sending_save_copy: Option<bool>, pub email_hooks: EmailHooks, pub sync: bool, pub sync_dir: Option<PathBuf>, pub sync_folders_strategy: FolderSyncStrategy, pub pgp: Option<PgpConfig>,
}
Expand description

The user’s account configuration.

It represents everything that the user can customize for a given account. It is the main configuration used by all other modules. Usually, it serves as a reference for building config file structure.

Fields§

§name: String

The name of the user account. It serves as an unique identifier for a given configuration.

§email: String

The email address of the user account.

§display_name: Option<String>

The display name of the user. It usually corresponds to the full name of the user.

§signature_delim: Option<String>

The email signature delimiter of the user signature. Defaults to -- \n.

§signature: Option<String>

Represents the email signature of the user. It can be either a path to a file (usually ~/.signature) or a raw string.

§downloads_dir: Option<PathBuf>

Represents the downloads directory. It is used for downloading attachments.

§folder_listing_page_size: Option<usize>

Represents the page size when listing folders. A page size of 0 disables the pagination and shows all available folders.

§folder_aliases: HashMap<String, String>

Represents the folder aliases hash map. There is 4 special aliases:

  • inbox: main folder containing incoming emails
  • draft(s): folder containing draft emails
  • sent: folder containing emails sent
  • trash: folder containing trashed emails
§email_listing_page_size: Option<usize>

Represents the page size when listing envelopes. A page size of 0 disables the pagination and shows all available envelopes.

§email_listing_datetime_fmt: Option<String>

Custom format for displaying envelopes date. See chrono::format::strftime for supported formats. Defaults to %F %R%:z.

§email_listing_datetime_local_tz: Option<bool>

If true, transform envelopes date timezone into the user’s local one. For example, if the user’s local timezone is UTC, the envelope date 2023-06-15T09:00:00+02:00 becomes 2023-06-15T07:00:00-00:00.

§email_reading_headers: Option<Vec<String>>

Represents headers visible at the top of email messages when reading them.

§email_reading_format: EmailTextPlainFormat

Represents the text/plain format as defined in the RFC 2646.

§email_writing_headers: Option<Vec<String>>

Represents headers visible at the top of emails when writing them (new/reply/forward).

§email_sending_save_copy: Option<bool>

Should save a copy of the email being sent in the sent folder. The sent folder can be customized using folder_aliases. Knowing that 1) saving an email is done by the Backend, 2) sending an email is done by the Sender, and 3) both have no relation together, it is the library user’s responsibility to check this option and to save the copy of the sent email.

AccountConfig {
    folder_aliases: HashMap::from_iter([("sent", "MyCustomSent")]),
    email_sending_save_copy: true,
    ..Default::default()
};
§email_hooks: EmailHooks

Represents the email hooks.

§sync: bool

Enables the synchronization of this account with a local Maildir backend.

§sync_dir: Option<PathBuf>

Custom root directory where the Maildir cache is saved. Defaults to $XDG_DATA_HOME/himalaya/<account-name>.

§sync_folders_strategy: FolderSyncStrategy

Represents the synchronization strategy to use for folders.

§pgp: Option<PgpConfig>

The configuration related to PGP encryption.

Implementations§

source§

impl AccountConfig

source

pub fn from(&self) -> Address<'_>

Build a mail_builder::headers::address from a user account configuration. This is mostly used for building the From header by message builders.

source

pub fn downloads_dir(&self) -> PathBuf

Expand the downloads directory path. Falls back to temporary directory.

source

pub fn download_fpath(&self, fname: impl AsRef<str>) -> Result<PathBuf>

Wrapper around downloads_dir() and rename_file_if_duplicate().

source

pub fn find_folder_alias(&self, folder: &str) -> Result<Option<String>>

Return the alias of the given folder if defined, otherwise return None.

source

pub fn get_folder_alias(&self, folder: &str) -> Result<String>

Return the alias of the given folder if defined, otherwise return the folder itself. Then expand shell variables.

source

pub fn inbox_folder_alias(&self) -> Result<String>

Return the inbox folder alias.

source

pub fn drafts_folder_alias(&self) -> Result<String>

Return the drafts folder alias.

source

pub fn sent_folder_alias(&self) -> Result<String>

Return the sent folder alias.

source

pub fn trash_folder_alias(&self) -> Result<String>

Return the trash folder alias.

source

pub fn email_listing_page_size(&self) -> usize

Return the email listing page size if defined, otherwise return the default one.

source

pub fn email_reading_headers(&self) -> Vec<String>

Return the email reading headers if defined, otherwise return the default ones.

source

pub fn email_writing_headers(&self) -> Vec<String>

Return the email writing headers if defined, otherwise return the default ones.

source

pub fn signature(&self) -> Result<Option<String>>

Return the full signature, including the delimiter.

source

pub fn sync_dir_exists(&self) -> bool

Return true if the sync directory already exists.

source

pub fn sync(&self) -> bool

Return true if the sync directory already exists and if the sync feature is enabled.

source

pub fn sync_dir(&self) -> Result<PathBuf>

Return the sync directory if exist, otherwise create it.

source

pub fn sync_db_builder(&self) -> Result<Connection>

Open a SQLite connection to the synchronization database.

source

pub fn generate_tpl_interpreter(&self) -> MimeInterpreterBuilder

Generate a template interpreter with prefilled options from the current user account configuration.

source

pub fn email_listing_datetime_fmt(&self) -> String

Return the email listing datetime format, otherwise return the default one.

source

pub fn email_listing_datetime_local_tz(&self) -> bool

Return the email listing datetime local timezone option, otherwise return the default one.

Trait Implementations§

source§

impl Clone for AccountConfig

source§

fn clone(&self) -> AccountConfig

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 AccountConfig

source§

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

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

impl Default for AccountConfig

source§

fn default() -> AccountConfig

Returns the “default value” for a type. Read more
source§

impl PartialEq for AccountConfig

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for AccountConfig

source§

impl StructuralEq for AccountConfig

source§

impl StructuralPartialEq for AccountConfig

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
§

impl<Src, Scheme> ApproxFrom<Src, Scheme> for Src
where Scheme: ApproxScheme,

§

type Err = NoError

The error type produced by a failed conversion.
§

fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>

Convert the given value into an approximately equivalent representation.
§

impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Src
where Dst: ApproxFrom<Src, Scheme>, Scheme: ApproxScheme,

§

type Err = <Dst as ApproxFrom<Src, Scheme>>::Err

The error type produced by a failed conversion.
§

fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>

Convert the subject into an approximately equivalent representation.
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
§

impl<T, Dst> ConvAsUtil<Dst> for T

§

fn approx(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject with the default scheme.
§

fn approx_by<Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject with a specific scheme.
§

impl<T> ConvUtil for T

§

fn approx_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst>,

Approximate the subject to a given type with the default scheme.
§

fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
where Self: Sized + ApproxInto<Dst, Scheme>, Scheme: ApproxScheme,

Approximate the subject to a given type with a specific scheme.
§

fn into_as<Dst>(self) -> Dst
where Self: Sized + Into<Dst>,

Convert the subject to a given type.
§

fn try_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + TryInto<Dst>,

Attempt to convert the subject to a given type.
§

fn value_as<Dst>(self) -> Result<Dst, Self::Err>
where Self: Sized + ValueInto<Dst>,

Attempt a value conversion of the subject to a given type.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
source§

impl<T> ToOwned for T
where T: Clone,

§

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
§

impl<Src> TryFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn try_from(src: Src) -> Result<Src, <Src as TryFrom<Src>>::Err>

Convert the given value into the subject type.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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.
§

impl<Src, Dst> TryInto<Dst> for Src
where Dst: TryFrom<Src>,

§

type Err = <Dst as TryFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn try_into(self) -> Result<Dst, <Src as TryInto<Dst>>::Err>

Convert the subject into the destination type.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<Src> ValueFrom<Src> for Src

§

type Err = NoError

The error type produced by a failed conversion.
§

fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>

Convert the given value into an exactly equivalent representation.
§

impl<Src, Dst> ValueInto<Dst> for Src
where Dst: ValueFrom<Src>,

§

type Err = <Dst as ValueFrom<Src>>::Err

The error type produced by a failed conversion.
§

fn value_into(self) -> Result<Dst, <Src as ValueInto<Dst>>::Err>

Convert the subject into an exactly equivalent representation.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> MaybeSync for T

§

impl<'p, T> OrderedSeq<'p, T> for T
where T: Clone,