use alloc::borrow::Cow;
pub struct Dater<'a> {
datetime: Cow<'a, str>,
}
impl<'a> Dater<'a> {
#[must_use]
pub const fn new(datetime: Cow<'a, str>) -> Self {
Self { datetime }
}
#[must_use]
pub fn datetime(&self) -> &str {
self.datetime.as_ref()
}
}
#[cfg(test)]
mod tests {
use super::*;
use alloc::borrow::Cow;
#[test]
fn dater_holds_datetime_string() {
let dt = Dater::new(Cow::from("2025-03-01T00:00:00.000000+00:00"));
assert_eq!(dt.datetime(), "2025-03-01T00:00:00.000000+00:00");
}
}