| 77 | } |
| 78 | |
| 79 | pub fn window_nth_value(frame: &[Vec<Box<dyn Value>>]) -> Vec<Box<dyn Value>> { |
| 80 | let frame_len = frame.len(); |
| 81 | let index = frame[0][1].as_int().unwrap(); |
| 82 | |
| 83 | let mut values: Vec<Box<dyn Value>> = Vec::with_capacity(frame_len); |
| 84 | for _ in 0..frame_len { |
| 85 | if index < 0 || index as usize >= frame_len { |
| 86 | values.push(Box::new(NullValue)); |
| 87 | } else { |
| 88 | values.push(frame[index as usize][0].clone()); |
| 89 | }; |
| 90 | } |
| 91 | |
| 92 | values |
| 93 | } |
| 94 | |
| 95 | pub fn window_last_value(frame: &[Vec<Box<dyn Value>>]) -> Vec<Box<dyn Value>> { |
| 96 | let frame_len = frame.len(); |