aboutsummaryrefslogtreecommitdiffstats
path: root/askama_parser/src/node.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-07-02 11:02:36 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-07-31 10:27:15 +0200
commit17ee42cb6a49e4bf4f7a61359445d46b1fc3d74c (patch)
tree04bef2611df92756fac257ffae7bd28fac6b30a9 /askama_parser/src/node.rs
parent3603d437619abb9b41a7e846d6f8d5fcbc0a7fc6 (diff)
downloadaskama-17ee42cb6a49e4bf4f7a61359445d46b1fc3d74c.tar.gz
askama-17ee42cb6a49e4bf4f7a61359445d46b1fc3d74c.tar.bz2
askama-17ee42cb6a49e4bf4f7a61359445d46b1fc3d74c.zip
parser: move trait impl closer to type definition
Diffstat (limited to 'askama_parser/src/node.rs')
-rw-r--r--askama_parser/src/node.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
index 8719d38..5d44162 100644
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -55,6 +55,17 @@ pub enum Whitespace {
Minimize,
}
+impl From<char> for Whitespace {
+ fn from(c: char) -> Self {
+ match c {
+ '+' => Self::Preserve,
+ '-' => Self::Suppress,
+ '~' => Self::Minimize,
+ _ => panic!("unsupported `Whitespace` conversion"),
+ }
+ }
+}
+
#[derive(Debug, PartialEq)]
pub struct Loop<'a> {
pub ws1: Ws,