use std::borrow::Cow;
use serde::{Deserialize, Serialize};
#[derive(Debug, Eq, PartialEq, Serialize, Deserialize, Clone)]
pub struct Author<'a> {
name: Cow<'a, str>,
email: Cow<'a, str>,
#[serde(skip_serializing_if = "Option::is_none")]
signingkey: Option<Cow<'a, str>>,
}
impl<'a> Author<'a> {
#[must_use]
pub const fn new(
name: Cow<'a, str>,
email: Cow<'a, str>,
signingkey: Option<Cow<'a, str>>,
) -> Self {
Self {
name,
email,
signingkey,
}
}
#[must_use]
pub fn name(&self) -> &str {
&self.name
}
#[must_use]
pub fn email(&self) -> &str {
&self.email
}
#[must_use]
pub fn signingkey(&self) -> Option<&str> {
self.signingkey.as_deref()
}
}