#[derive(Clone, Debug, Default)]
pub struct Metadata {
pub title: Option<String>,
pub author: Option<String>,
pub subject: Option<String>,
pub keywords: Vec<String>,
pub creator: Option<String>,
pub producer: Option<String>,
pub creation_date: Option<String>,
pub mod_date: Option<String>,
}
impl Metadata {
pub fn new() -> Self {
Self::default()
}
pub fn title(mut self, title: impl Into<String>) -> Self {
self.title = Some(title.into());
self
}
pub fn author(mut self, author: impl Into<String>) -> Self {
self.author = Some(author.into());
self
}
pub fn subject(mut self, subject: impl Into<String>) -> Self {
self.subject = Some(subject.into());
self
}
pub fn keywords(mut self, keywords: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.keywords = keywords.into_iter().map(|k| k.into()).collect();
self
}
pub fn creator(mut self, creator: impl Into<String>) -> Self {
self.creator = Some(creator.into());
self
}
pub fn producer(mut self, producer: impl Into<String>) -> Self {
self.producer = Some(producer.into());
self
}
}