aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src/helpers/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'askama_shared/src/helpers/mod.rs')
-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,
-}