aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src/helpers
diff options
context:
space:
mode:
authorLibravatar René Kijewski <kijewski@library.vetmed.fu-berlin.de>2022-06-08 12:52:00 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-06-08 13:36:48 +0200
commit6cce13f076bdd3e8d9b0bf888c0464a1af9df25f (patch)
tree7f54a53f844c5ff622c2af22437851010ad65b29 /askama_shared/src/helpers
parent0de54192a039943a687d579e15cb87bfc4801589 (diff)
downloadaskama-6cce13f076bdd3e8d9b0bf888c0464a1af9df25f.tar.gz
askama-6cce13f076bdd3e8d9b0bf888c0464a1af9df25f.tar.bz2
askama-6cce13f076bdd3e8d9b0bf888c0464a1af9df25f.zip
Merge askama_derive into askama
Diffstat (limited to 'askama_shared/src/helpers')
-rw-r--r--askama_shared/src/helpers/mod.rs48
1 files changed, 0 insertions, 48 deletions
diff --git a/askama_shared/src/helpers/mod.rs b/askama_shared/src/helpers/mod.rs
deleted file mode 100644
index 79a1ada..0000000
--- a/askama_shared/src/helpers/mod.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-use std::iter::{Enumerate, Peekable};
-
-pub struct TemplateLoop<I>
-where
- I: Iterator,
-{
- iter: Peekable<Enumerate<I>>,
-}
-
-impl<I> TemplateLoop<I>
-where
- I: Iterator,
-{
- #[inline]
- pub fn new(iter: I) -> Self {
- TemplateLoop {
- iter: iter.enumerate().peekable(),
- }
- }
-}
-
-impl<I> Iterator for TemplateLoop<I>
-where
- I: Iterator,
-{
- type Item = (<I as Iterator>::Item, LoopItem);
-
- #[inline]
- fn next(&mut self) -> Option<(<I as Iterator>::Item, LoopItem)> {
- self.iter.next().map(|(index, item)| {
- (
- item,
- LoopItem {
- index,
- first: index == 0,
- last: self.iter.peek().is_none(),
- },
- )
- })
- }
-}
-
-#[derive(Copy, Clone)]
-pub struct LoopItem {
- pub index: usize,
- pub first: bool,
- pub last: bool,
-}