diff options
Diffstat (limited to 'headers/src/header_components/file_meta.rs')
-rw-r--r-- | headers/src/header_components/file_meta.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/headers/src/header_components/file_meta.rs b/headers/src/header_components/file_meta.rs index e8f1d1e..395e71b 100644 --- a/headers/src/header_components/file_meta.rs +++ b/headers/src/header_components/file_meta.rs @@ -1,11 +1,10 @@ - use chrono::DateTime; use chrono::Utc; use std::mem::replace; -#[cfg(feature="serde")] -use serde::{Serialize, Deserialize}; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; /// A struct representing common file metadata. /// @@ -19,29 +18,29 @@ use serde::{Serialize, Deserialize}; /// some point, potentially in a different `mail-*` /// crate. #[derive(Debug, Clone, Eq, PartialEq, Hash, Default)] -#[cfg_attr(feature="serde", derive(Serialize, Deserialize))] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct FileMeta { /// The file name. /// /// Note that this utility is limited to utf-8 file names. /// This is normally used when downloading a attachment to /// choose the default file name. - #[cfg_attr(feature="serde", serde(default))] + #[cfg_attr(feature = "serde", serde(default))] pub file_name: Option<String>, /// The creation date of the file (in utc). - #[cfg_attr(feature="serde", serde(default))] - #[cfg_attr(feature="serde", serde(with = "super::utils::serde::opt_date_time"))] + #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "serde", serde(with = "super::utils::serde::opt_date_time"))] pub creation_date: Option<DateTime<Utc>>, /// The last modification date of the file (in utc). - #[cfg_attr(feature="serde", serde(default))] - #[cfg_attr(feature="serde", serde(with = "super::utils::serde::opt_date_time"))] + #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "serde", serde(with = "super::utils::serde::opt_date_time"))] pub modification_date: Option<DateTime<Utc>>, /// The date time the file was read, i.e. placed in the mail (in utc). - #[cfg_attr(feature="serde", serde(default))] - #[cfg_attr(feature="serde", serde(with = "super::utils::serde::opt_date_time"))] + #[cfg_attr(feature = "serde", serde(default))] + #[cfg_attr(feature = "serde", serde(with = "super::utils::serde::opt_date_time"))] pub read_date: Option<DateTime<Utc>>, /// The size the file should have. @@ -50,8 +49,8 @@ pub struct FileMeta { /// of a mime-multi part body (e.g. an attachments) and you can never /// rely on it to e.g. skip ahead. But it has some uses wrt. thinks /// like external headers. - #[cfg_attr(feature="serde", serde(default))] - pub size: Option<usize> + #[cfg_attr(feature = "serde", serde(default))] + pub size: Option<usize>, } macro_rules! impl_replace_none { @@ -69,7 +68,6 @@ macro_rules! impl_replace_none { } impl FileMeta { - /// Replaces all fields which are `None` with the value of the field in `other_meta`. pub fn replace_empty_fields_with(&mut self, other_meta: &Self) { impl_replace_none! { |