aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-10-06 11:48:22 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-11-01 12:52:09 +0100
commitc951fcefcafe604136cf0263c6fd51716860b754 (patch)
tree9609aa6fac14529bcbb85ee985e000ab05cb4ac6 /askama_derive/src/generator.rs
parent1782b63caa092b0f81d15dfcbb7063ed363dba60 (diff)
downloadaskama-c951fcefcafe604136cf0263c6fd51716860b754.tar.gz
askama-c951fcefcafe604136cf0263c6fd51716860b754.tar.bz2
askama-c951fcefcafe604136cf0263c6fd51716860b754.zip
Implement Default for MapChain
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 74d1869..8d120be 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1775,13 +1775,6 @@ impl<'a, K: 'a, V: 'a> MapChain<'a, K, V>
where
K: cmp::Eq + hash::Hash,
{
- pub(crate) fn new() -> MapChain<'a, K, V> {
- MapChain {
- parent: None,
- scopes: vec![HashMap::new()],
- }
- }
-
fn with_parent<'p>(parent: &'p MapChain<'_, K, V>) -> MapChain<'p, K, V> {
MapChain {
parent: Some(parent),
@@ -1844,6 +1837,15 @@ impl MapChain<'_, &str, LocalMeta> {
}
}
+impl<'a, K: Eq + hash::Hash, V> Default for MapChain<'a, K, V> {
+ fn default() -> Self {
+ Self {
+ parent: None,
+ scopes: vec![HashMap::new()],
+ }
+ }
+}
+
/// Returns `true` if enough assumptions can be made,
/// to determine that `self` is copyable.
fn is_copyable(expr: &Expr<'_>) -> bool {