diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-02-01 14:45:03 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-02-01 14:54:33 +0100 |
commit | f93c5a0d7b2ef095163fd77d653102c9ce9f673b (patch) | |
tree | f02c08e544e52c7d3936e3c8933397e4eba4e954 /askama_shared/src/generator.rs | |
parent | 9c4bb9f3c3f5b72f807dc25313928ba2752b54a4 (diff) | |
download | askama-f93c5a0d7b2ef095163fd77d653102c9ce9f673b.tar.gz askama-f93c5a0d7b2ef095163fd77d653102c9ce9f673b.tar.bz2 askama-f93c5a0d7b2ef095163fd77d653102c9ce9f673b.zip |
Bring Ws type name in line with API guidelines
Diffstat (limited to 'askama_shared/src/generator.rs')
-rw-r--r-- | askama_shared/src/generator.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index 866fd7b..32968de 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -3,7 +3,7 @@ use crate::filters; use crate::heritage::{Context, Heritage}; use crate::input::{Source, TemplateInput}; use crate::parser::{ - parse, Cond, Expr, MatchParameter, MatchParameters, MatchVariant, Node, Target, When, WS, + parse, Cond, Expr, MatchParameter, MatchParameters, MatchVariant, Node, Target, When, Ws, }; use proc_macro2::Span; @@ -151,7 +151,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { self.handle(ctx, &ctx.nodes, buf, AstLevel::Top) }?; - self.flush_ws(WS(false, false)); + self.flush_ws(Ws(false, false)); buf.writeln("Ok(())")?; buf.writeln("}")?; @@ -451,7 +451,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { self.write_loop(ctx, buf, ws1, var, iter, body, ws2)?; } Node::BlockDef(ws1, name, _, ws2) => { - self.write_block(buf, Some(name), WS(ws1.0, ws2.1))?; + self.write_block(buf, Some(name), Ws(ws1.0, ws2.1))?; } Node::Include(ws, path) => { size_hint += self.handle_include(ctx, buf, ws, path)?; @@ -498,7 +498,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { ctx: &'a Context, buf: &mut Buffer, conds: &'a [Cond], - ws: WS, + ws: Ws, ) -> Result<usize, CompileError> { let mut flushed = 0; let mut arm_sizes = Vec::new(); @@ -559,10 +559,10 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { &mut self, ctx: &'a Context, buf: &mut Buffer, - ws1: WS, + ws1: Ws, expr: &Expr, arms: &'a [When], - ws2: WS, + ws2: Ws, ) -> Result<usize, CompileError> { self.flush_ws(ws1); let flushed = self.write_buf_writable(buf)?; @@ -648,11 +648,11 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { &mut self, ctx: &'a Context, buf: &mut Buffer, - ws1: WS, + ws1: Ws, var: &'a Target, iter: &Expr, body: &'a [Node], - ws2: WS, + ws2: Ws, ) -> Result<usize, CompileError> { self.handle_ws(ws1); self.locals.push(); @@ -704,7 +704,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { &mut self, ctx: &'a Context, buf: &mut Buffer, - ws: WS, + ws: Ws, scope: Option<&str>, name: &str, args: &[Expr], @@ -801,7 +801,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { &mut self, ctx: &'a Context, buf: &mut Buffer, - ws: WS, + ws: Ws, path: &str, ) -> Result<usize, CompileError> { self.flush_ws(ws); @@ -839,7 +839,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { fn write_let_decl( &mut self, buf: &mut Buffer, - ws: WS, + ws: Ws, var: &'a Target, ) -> Result<(), CompileError> { self.handle_ws(ws); @@ -866,7 +866,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { fn write_let( &mut self, buf: &mut Buffer, - ws: WS, + ws: Ws, var: &'a Target, val: &Expr, ) -> Result<(), CompileError> { @@ -920,7 +920,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { &mut self, buf: &mut Buffer, name: Option<&'a str>, - outer: WS, + outer: Ws, ) -> Result<usize, CompileError> { // Flush preceding whitespace according to the outer WS spec self.flush_ws(outer); @@ -981,7 +981,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { Ok(size_hint) } - fn write_expr(&mut self, ws: WS, s: &'a Expr<'a>) { + fn write_expr(&mut self, ws: Ws, s: &'a Expr<'a>) { self.handle_ws(ws); self.buf_writable.push(Writable::Expr(s)); } @@ -1084,7 +1084,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { } } - fn write_comment(&mut self, ws: WS) { + fn write_comment(&mut self, ws: Ws) { self.handle_ws(ws); } @@ -1530,7 +1530,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { // Combines `flush_ws()` and `prepare_ws()` to handle both trailing whitespace from the // preceding literal and leading whitespace from the succeeding literal. - fn handle_ws(&mut self, ws: WS) { + fn handle_ws(&mut self, ws: Ws) { self.flush_ws(ws); self.prepare_ws(ws); } @@ -1538,7 +1538,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { // If the previous literal left some trailing whitespace in `next_ws` and the // prefix whitespace suppressor from the given argument, flush that whitespace. // In either case, `next_ws` is reset to `None` (no trailing whitespace). - fn flush_ws(&mut self, ws: WS) { + fn flush_ws(&mut self, ws: Ws) { if self.next_ws.is_some() && !ws.0 { let val = self.next_ws.unwrap(); if !val.is_empty() { @@ -1551,7 +1551,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { // Sets `skip_ws` to match the suffix whitespace suppressor from the given // argument, to determine whether to suppress leading whitespace from the // next literal. - fn prepare_ws(&mut self, ws: WS) { + fn prepare_ws(&mut self, ws: Ws) { self.skip_ws = ws.1; } } |