From 8f1cf091f62a36e30b8cf3e97b0de7eaec58e1bf Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 2 Mar 2026 13:45:42 +0800 Subject: Bump version to 0.1.2 and add From impls for &str and Cow --- src/template.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/template.rs b/src/template.rs index 622f191..27e14df 100644 --- a/src/template.rs +++ b/src/template.rs @@ -30,6 +30,24 @@ impl From for Template { } } +impl<'a> From<&'a str> for Template { + fn from(s: &'a str) -> Self { + Template { + template_str: s.to_string(), + ..Default::default() + } + } +} + +impl<'a> From> for Template { + fn from(s: std::borrow::Cow<'a, str>) -> Self { + Template { + template_str: s.into_owned(), + ..Default::default() + } + } +} + impl std::fmt::Display for Template { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let cloned = self.clone(); -- cgit