diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-08 12:18:34 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-08-08 12:18:34 +0200 |
commit | a993920ae634c9478a5d69480886586a338b3306 (patch) | |
tree | a778f9c8715de547bdb2a3620c0601d207a3ae26 /askama_derive | |
parent | 21e5c86ea2b001906dc690f8bf5bc42decbfbce2 (diff) | |
download | askama-a993920ae634c9478a5d69480886586a338b3306.tar.gz askama-a993920ae634c9478a5d69480886586a338b3306.tar.bz2 askama-a993920ae634c9478a5d69480886586a338b3306.zip |
Move path_as_identifier() closer to driver
Diffstat (limited to 'askama_derive')
-rw-r--r-- | askama_derive/src/generator.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index f2bb88a..a90fb40 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -6,18 +6,6 @@ use std::collections::HashSet; use syn; use quote::{Tokens, ToTokens}; -fn path_as_identifier(s: &str) -> String { - let mut res = String::new(); - for c in s.chars() { - if c.is_alphanumeric() { - res.push(c); - } else { - res.push_str(&format!("{:x}", c as u32)); - } - } - res -} - struct Generator<'a> { buf: String, indent: u8, @@ -451,6 +439,18 @@ impl<'a> Generator<'a> { } +fn path_as_identifier(s: &str) -> String { + let mut res = String::new(); + for c in s.chars() { + if c.is_alphanumeric() { + res.push(c); + } else { + res.push_str(&format!("{:x}", c as u32)); + } + } + res +} + pub fn generate(ast: &syn::DeriveInput, path: &str, mut nodes: Vec<Node>) -> String { let mut base: Option<Expr> = None; let mut blocks = Vec::new(); |