aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2022-06-15 22:17:53 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-06-15 22:45:40 +0200
commitdf3584c35c2734a418bc73ac39402118a209c8e1 (patch)
tree25ec290ae24014aa11cbde11c8fd6196ba03ae99
parent144bce7707520e58e11ad0d6e5433d870b56494c (diff)
downloadaskama-df3584c35c2734a418bc73ac39402118a209c8e1.tar.gz
askama-df3584c35c2734a418bc73ac39402118a209c8e1.tar.bz2
askama-df3584c35c2734a418bc73ac39402118a209c8e1.zip
Remove hash builder parameter from generator
The generator cannot be accessed outside of crate, so it's not possible to override the default hasher.
-rw-r--r--askama_derive/src/generator.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index c20e171..d89d2da 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -229,11 +229,12 @@ fn find_used_templates(
}
Ok(())
}
-struct Generator<'a, S: std::hash::BuildHasher> {
+
+struct Generator<'a> {
// The template input state: original struct AST and attributes
input: &'a TemplateInput<'a>,
// All contexts, keyed by the package-relative template path
- contexts: &'a HashMap<&'a Path, Context<'a>, S>,
+ contexts: &'a HashMap<&'a Path, Context<'a>>,
// The heritage contains references to blocks and their ancestry
heritage: Option<&'a Heritage<'a>>,
// Variables accessible directly from the current scope (not redirected to context)
@@ -256,14 +257,14 @@ struct Generator<'a, S: std::hash::BuildHasher> {
whitespace: WhitespaceHandling,
}
-impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
+impl<'a> Generator<'a> {
fn new<'n>(
input: &'n TemplateInput<'_>,
- contexts: &'n HashMap<&'n Path, Context<'n>, S>,
+ contexts: &'n HashMap<&'n Path, Context<'n>>,
heritage: Option<&'n Heritage<'_>>,
locals: MapChain<'n, &'n str, LocalMeta>,
whitespace: WhitespaceHandling,
- ) -> Generator<'n, S> {
+ ) -> Generator<'n> {
Generator {
input,
contexts,
@@ -278,7 +279,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> {
}
}
- fn child(&mut self) -> Generator<'_, S> {
+ fn child(&mut self) -> Generator<'_> {
let locals = MapChain::with_parent(&self.locals);
Self::new(
self.input,