summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/template.rs18
1 files changed, 18 insertions, 0 deletions
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<String> 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<std::borrow::Cow<'a, str>> 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();