Returns an iterator referencing the last n items of the stack, in bottom-most to top-most order.
(&self, n: usize)
| 388 | /// Returns an iterator referencing the last n items of the stack, |
| 389 | /// in bottom-most to top-most order. |
| 390 | pub fn peekn(&self, n: usize) -> impl Iterator<Item = &Val> + '_ { |
| 391 | let len = self.len(); |
| 392 | assert!(n <= len); |
| 393 | |
| 394 | let partition = len - n; |
| 395 | self.inner[partition..].into_iter() |
| 396 | } |
| 397 | |
| 398 | /// Pops the top element of the stack, if any. |
| 399 | pub fn pop(&mut self) -> Option<Val> { |