use std::borrow::Cow;
use crate::LogValue;
#[derive(Debug, Clone)]
pub struct LogRecord {
key: Cow<'static, str>,
value: LogValue,
}
impl LogRecord {
pub const fn new(key: Cow<'static, str>, value: LogValue) -> Self {
Self { key, value }
}
pub fn key(&self) -> &str {
&self.key
}
pub const fn value(&self) -> &LogValue {
&self.value
}
}
impl<K, V> From<(K, V)> for LogRecord
where
K: Into<Cow<'static, str>>,
V: Into<LogValue>,
{
fn from((key, value): (K, V)) -> Self {
Self::new(key.into(), value.into())
}
}