From 0b27f8371af209486f2eb83e7f2fb05f7b35fb46 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 6 Mar 2023 21:35:26 +0900 Subject: [PATCH] templater: make Literal(str) or str usable as a template --- src/templater.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/templater.rs b/src/templater.rs index ecc52b5a1..7c7bef063 100644 --- a/src/templater.rs +++ b/src/templater.rs @@ -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))