From a50212a09748741d3207f8c71781f2496cfc2b64 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Sun, 2 Jul 2023 11:37:29 +0200 Subject: parser: move impl blocks closer to type definitions --- askama_parser/src/node.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'askama_parser/src/node.rs') 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>> { + 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>> { - 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))) } -- cgit