use std::borrow::Cow;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct RequestCookie<'c> {
pub(crate) name: Cow<'c, str>,
pub(crate) value: Cow<'c, str>,
}
impl<'c> RequestCookie<'c> {
pub fn new<N, V>(name: N, value: V) -> RequestCookie<'c>
where
N: Into<Cow<'c, str>>,
V: Into<Cow<'c, str>>,
{
RequestCookie {
name: name.into(),
value: value.into(),
}
}
pub fn name(&self) -> &str {
&self.name
}
pub fn value(&self) -> &str {
&self.value
}
}
impl std::fmt::Display for RequestCookie<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}={}", self.name, self.value)
}
}