pub trait Commenter {
fn commenter_id(&self) -> i64;
fn is_moderator(&self) -> bool {
false
}
}
#[derive(Debug)]
pub enum Author<'a, U> {
User(&'a U),
Guest {
name: &'a str,
email: &'a str,
},
}
impl<'a, U> Author<'a, U> {
#[must_use]
pub const fn user(user: &'a U) -> Self {
Self::User(user)
}
#[must_use]
pub const fn guest(name: &'a str, email: &'a str) -> Self {
Self::Guest { name, email }
}
}
impl<U> Clone for Author<'_, U> {
fn clone(&self) -> Self {
*self
}
}
impl<U> Copy for Author<'_, U> {}