use super::*;
impl MonthCaption {
pub(crate) fn caption(&self, year: i64, month: u32) -> &'static str {
let mut slot: RefMut<Option<(i64, u32, &'static str)>> = self.get_cached().borrow_mut();
if let Some((cached_year, cached_month, caption)) = *slot
&& cached_year == year
&& cached_month == month
{
return caption;
}
let caption: &'static str = Box::leak(format!("{year:04}-{month:02}").into_boxed_str());
*slot = Some((year, month, caption));
caption
}
}