MCPcopy Index your code
hub / github.com/RustPython/RustPython / for_each_segment

Method for_each_segment

crates/vm/src/protocol/buffer.rs:280–293  ·  view source on GitHub ↗
(&self, try_contiguous: bool, mut f: F)

Source from the content-addressed store, hash-verified

278 }
279
280 pub fn for_each_segment<F>(&self, try_contiguous: bool, mut f: F)
281 where
282 F: FnMut(Range<isize>),
283 {
284 if self.ndim() == 0 {
285 f(0..self.itemsize as isize);
286 return;
287 }
288 if try_contiguous && self.is_last_dim_contiguous() {
289 self._for_each_segment::<_, true>(0, 0, &mut f);
290 } else {
291 self._for_each_segment::<_, false>(0, 0, &mut f);
292 }
293 }
294
295 fn _for_each_segment<F, const CONTIGUOUS: bool>(&self, mut index: isize, dim: usize, f: &mut F)
296 where

Callers 2

append_toMethod · 0.80
append_toMethod · 0.80

Calls 3

fFunction · 0.50
ndimMethod · 0.45

Tested by

no test coverage detected