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

Method nth_back

arrow-buffer/src/util/bit_iterator.rs:158–177  ·  view source on GitHub ↗
(&mut self, n: usize)

Source from the content-addressed store, hash-verified

156 }
157
158 fn nth_back(&mut self, n: usize) -> Option<Self::Item> {
159 // Check if we can advance to the desired offset.
160 // When n is 0 it means we want the next_back() value
161 // and when n is 1 we want the next_back().next_back() value
162 // so subtracting n to the current offset and not n - 1
163 match self.end_offset.checked_sub(n) {
164 // Yes, and still within bounds
165 Some(new_offset) if self.current_offset < new_offset => {
166 self.end_offset = new_offset;
167 }
168
169 // Either underflow or would exceed current_offset
170 _ => {
171 self.current_offset = self.end_offset;
172 return None;
173 }
174 }
175
176 self.next_back()
177 }
178}
179
180/// Iterator of contiguous ranges of set bits within a provided packed bitmask

Callers 2

get_valueMethod · 0.45

Calls 2

checked_subMethod · 0.45
next_backMethod · 0.45

Tested by 1