aboutsummaryrefslogtreecommitdiffstats
path: root/askama_parser/src/node.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-07-02 11:37:29 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-07-31 10:27:15 +0200
commita50212a09748741d3207f8c71781f2496cfc2b64 (patch)
tree4e3465e7bdbe8bded807079d1759cbdcd04be506 /askama_parser/src/node.rs
parentdcfa5e1c694bdcb237801eb09398d70f98a39a97 (diff)
downloadaskama-a50212a09748741d3207f8c71781f2496cfc2b64.tar.gz
askama-a50212a09748741d3207f8c71781f2496cfc2b64.tar.bz2
askama-a50212a09748741d3207f8c71781f2496cfc2b64.zip
parser: move impl blocks closer to type definitions
Diffstat (limited to 'askama_parser/src/node.rs')
-rw-r--r--askama_parser/src/node.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs
index 6a8899f..a76fdf0 100644
--- a/askama_parser/src/node.rs
+++ b/askama_parser/src/node.rs
@@ -35,6 +35,12 @@ pub enum Node<'a> {
Continue(Ws),
}
+impl Node<'_> {
+ pub(super) fn parse<'i>(i: &'i str, s: &State<'_>) -> IResult<&'i str, Vec<Node<'i>>> {
+ parse_template(i, s)
+ }
+}
+
#[derive(Debug, PartialEq)]
pub enum Target<'a> {
Name(&'a str),
@@ -47,6 +53,12 @@ pub enum Target<'a> {
Path(Vec<&'a str>),
}
+impl Target<'_> {
+ pub(super) fn parse(i: &str) -> IResult<&str, Target<'_>> {
+ target(i)
+ }
+}
+
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Whitespace {
Preserve,
@@ -101,18 +113,6 @@ pub struct CondTest<'a> {
pub expr: Expr<'a>,
}
-impl Node<'_> {
- pub(super) fn parse<'i>(i: &'i str, s: &State<'_>) -> IResult<&'i str, Vec<Node<'i>>> {
- parse_template(i, s)
- }
-}
-
-impl Target<'_> {
- pub(super) fn parse(i: &str) -> IResult<&str, Target<'_>> {
- target(i)
- }
-}
-
fn expr_handle_ws(i: &str) -> IResult<&str, Whitespace> {
alt((char('-'), char('+'), char('~')))(i).map(|(s, r)| (s, Whitespace::from(r)))
}