templater: make Literal(str) or str usable as a template

This commit is contained in:
Yuya Nishihara 2023-03-06 21:35:26 +09:00
parent 7b206e6fb5
commit 0b27f8371a

View file

@ -55,6 +55,12 @@ impl Template<()> for String {
}
}
impl Template<()> for &str {
fn format(&self, _: &(), formatter: &mut dyn Formatter) -> io::Result<()> {
formatter.write_str(self)
}
}
impl Template<()> for Timestamp {
fn format(&self, _: &(), formatter: &mut dyn Formatter) -> io::Result<()> {
formatter.write_str(&time_util::format_absolute_timestamp(self))