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

Method nth

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

Source from the content-addressed store, hash-verified

105
106 #[inline]
107 fn nth(&mut self, n: usize) -> Option<Self::Item> {
108 // Check if we can advance to the desired offset
109 match self.current.checked_add(n) {
110 // Yes, and still within bounds
111 Some(new_current) if new_current < self.current_end => {
112 self.current = new_current;
113 }
114
115 // Either overflow or would exceed current_end
116 _ => {
117 self.current = self.current_end;
118 return None;
119 }
120 }
121
122 self.next()
123 }
124
125 #[inline]
126 fn last(mut self) -> Option<Self::Item> {

Callers 6

decode_columnFunction · 0.45
setupMethod · 0.45
assert_nthFunction · 0.45
get_start_end_offsetFunction · 0.45

Calls 2

checked_addMethod · 0.45
nextMethod · 0.45

Tested by 1

assert_nthFunction · 0.36