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
// webrust/src/iter/enumerate.rs
//! # Python-style Enumerate Function
//!
//! Pairs each element with its index, similar to Python's built-in `enumerate()`.
//! Works with any iterator, including webrust ranges.
//!
//! ## Examples
//!
//! ```rust
//! use webrust::prelude::*;
//! # fn example() {
//! let items = vec!["apple", "banana", "cherry"];
//! for (index, item) in enumerate(&items) {
//! println!("{}: {}", index, item);
//! }
//! // Output: 0: apple, 1: banana, 2: cherry
//!
//! // With ranges
//! for (index, value) in enumerate(0.to(10).by(2)) {
//! println!("Position {}: Value {}", index, value);
//! }
//!
//! // Custom start (manual offset)
//! let start = 1;
//! for (index, item) in enumerate(&items) {
//! println!("{}: {}", index + start, item);
//! }
//! # }
//! ```
//!
//! This is a thin wrapper around Rust's `.enumerate()` with
//! function-based syntax familiar to Python developers.