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

Method saturated_at

crates/vm/src/sliceable.rs:296–303  ·  view source on GitHub ↗
(&self, len: usize)

Source from the content-addressed store, hash-verified

294
295impl SequenceIndexOp for isize {
296 fn saturated_at(&self, len: usize) -> usize {
297 let len = len.to_isize().unwrap_or(Self::MAX);
298 let mut p = *self;
299 if p < 0 {
300 p += len;
301 }
302 p.clamp(0, len) as usize
303 }
304
305 fn wrapped_at(&self, len: usize) -> Option<usize> {
306 let mut p = *self;

Callers 4

get_find_rangeMethod · 0.80
saturate_indexMethod · 0.80
adjust_indicesMethod · 0.80
saturateMethod · 0.80

Calls 1

absMethod · 0.80

Tested by

no test coverage detected