docx_reader/documents/doc_props/
mod.rs

1mod app;
2mod core;
3mod custom;
4
5pub use self::app::*;
6pub use self::core::*;
7pub use self::custom::*;
8
9use serde::Serialize;
10
11#[derive(Debug, Clone, PartialEq, Serialize)]
12#[serde(rename_all = "camelCase")]
13pub struct DocProps {
14	pub app: AppProps,
15	pub core: CoreProps,
16	pub custom: CustomProps,
17}
18
19impl DocProps {
20	pub(crate) fn new(core_config: CorePropsConfig) -> DocProps {
21		let app = AppProps::new();
22		let core = CoreProps::new(core_config);
23		let custom = CustomProps::new();
24		DocProps { app, core, custom }
25	}
26
27	pub fn created_at(mut self, date: &str) -> Self {
28		self.core = self.core.created_at(date);
29		self
30	}
31
32	pub fn updated_at(mut self, date: &str) -> Self {
33		self.core = self.core.updated_at(date);
34		self
35	}
36
37	pub fn custom_property(mut self, name: impl Into<String>, item: impl Into<String>) -> Self {
38		self.custom = self.custom.add_custom_property(name.into(), item.into());
39		self
40	}
41}
42
43#[derive(Debug)]
44pub struct XMLDocProps {
45	pub app: Vec<u8>,
46	pub core: Vec<u8>,
47	pub custom: Vec<u8>,
48}