1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! Iterate over an array while keeping a lot of useful information about the current iteration in an object.
//!
//! Structure of the object generated for each value:
//!
//! | Field | Type | Description |
//! | ------- | ------ | ------------------------------------------------------------- |
//! | value | Value | the original value included in the array |
//! | index | Number | the 1-indexed position of the value in the array |
//! | index0 | Number | the 0-indexed position of the value in the array |
//! | rindex | Number | the 1-indexed position of the value from the end of the array |
//! | rindex0 | Number | the 0-indexed position of the value from the end of the array |
//! | first | Bool | whether it is the first value of the array |
//! | last | Bool | whether it is the last value of the array |
//!
//! ### Example
//!
//! <div class="example-wrap"><pre class="rust rust-example-rendered"><span style="position: absolute; right: 0; top: 0; padding: 0.1rem 0.4rem 0 0; font-size: 0.75em; font-weight: bold; color: #333;">input</span><code><span class="fn">iter</span>([<span class="string">"hello"</span>, <span class="number">42</span>])</code></pre></div>
//!
//! <div class="example-wrap"><pre class="rust rust-example-rendered"><span style="position: absolute; right: 0; top: 0; padding: 0.1rem 0.4rem 0 0; font-size: 0.75em; font-weight: bold; color: #333;">output</span><code>[{
//! value: <span class="string">"hello"</span>,
//! index: <span class="number">1</span>,
//! index0: <span class="number">0</span>,
//! rindex: <span class="number">2</span>,
//! rindex0: <span class="number">1</span>,
//! first: <span class="bool-val">true</span>,
//! last: <span class="bool-val">false</span>,
//! }, {
//! value: <span class="number">42</span>,
//! index: <span class="number">2</span>,
//! index0: <span class="number">1</span>,
//! rindex: <span class="number">1</span>,
//! rindex0: <span class="number">0</span>,
//! first: <span class="bool-val">false</span>,
//! last: <span class="bool-val">true</span>,
//! }]</code></pre></div>
use crate::;
pub