docx_reader/documents/doc_props/
core.rsuse serde::Serialize;
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CoreProps {
config: CorePropsConfig,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct CorePropsConfig {
created: Option<String>,
creator: Option<String>,
description: Option<String>,
language: Option<String>,
last_modified_by: Option<String>,
modified: Option<String>,
revision: Option<usize>,
subject: Option<String>,
title: Option<String>,
}
impl Default for CorePropsConfig {
fn default() -> Self {
Self {
created: None,
creator: None,
description: None,
language: None,
last_modified_by: None,
modified: None,
revision: None,
subject: None,
title: None,
}
}
}
impl Default for CoreProps {
fn default() -> Self {
Self {
config: CorePropsConfig::default(),
}
}
}
impl CoreProps {
pub(crate) fn new(config: CorePropsConfig) -> CoreProps {
CoreProps { config }
}
pub fn created_at(mut self, date: &str) -> Self {
self.config.created = Some(date.to_owned());
self
}
pub fn updated_at(mut self, date: &str) -> Self {
self.config.modified = Some(date.to_owned());
self
}
}
impl CorePropsConfig {
pub fn new() -> Self {
CorePropsConfig {
created: None,
creator: None,
description: None,
language: None,
last_modified_by: None,
modified: None,
revision: None,
subject: None,
title: None,
}
}
}