sonet_rs/util.rs
1/// Works like Java's Iterator. Used to add order-based macro functions
2pub struct JIterator<T> {
3
4 /// The full data
5 vec: Vec<T>,
6
7 /// The current position
8 position: usize,
9}
10
11/// Default Implementation
12impl<T> JIterator<T> {
13
14 /// Creates an iterator instance
15 pub fn new(vec: Vec<T>) -> Self {
16 return Self {
17 vec,
18 position: 0,
19 };
20 }
21
22 /// Returns the value of the current position and increments the position by one.
23 pub fn next(&mut self) -> &T {
24 self.position += 1;
25 &self.vec[self.position - 1]
26 }
27}
28
29pub struct Application {
30
31}