MCPcopy Create free account
hub / github.com/apache/arrow-rs / nth_back

Method nth_back

arrow-array/src/iterator.rs:159–175  ·  view source on GitHub ↗
(&mut self, n: usize)

Source from the content-addressed store, hash-verified

157
158 #[inline]
159 fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
160 // Check if we advance to the one before the desired offset
161 match self.current_end.checked_sub(n) {
162 // Yes, and still within bounds
163 Some(new_offset) if self.current < new_offset => {
164 self.current_end = new_offset;
165 }
166
167 // Either underflow or would exceed current
168 _ => {
169 self.current = self.current_end;
170 return None;
171 }
172 }
173
174 self.next_back()
175 }
176}
177
178/// all arrays have known size.

Callers 2

setupMethod · 0.45
assert_nth_backFunction · 0.45

Calls 2

checked_subMethod · 0.45
next_backMethod · 0.45

Tested by 1

assert_nth_backFunction · 0.36