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

Method get

crates/wtf8/src/lib.rs:1137–1155  ·  view source on GitHub ↗
(&self, range: impl ops::RangeBounds<usize>)

Source from the content-addressed store, hash-verified

1135 }
1136
1137 pub fn get(&self, range: impl ops::RangeBounds<usize>) -> Option<&Self> {
1138 let start = match range.start_bound() {
1139 ops::Bound::Included(&i) => i,
1140 ops::Bound::Excluded(&i) => i.saturating_add(1),
1141 ops::Bound::Unbounded => 0,
1142 };
1143 let end = match range.end_bound() {
1144 ops::Bound::Included(&i) => i.saturating_add(1),
1145 ops::Bound::Excluded(&i) => i,
1146 ops::Bound::Unbounded => self.len(),
1147 };
1148 // is_code_point_boundary checks that the index is in [0, .len()]
1149 if start <= end && is_code_point_boundary(self, start) && is_code_point_boundary(self, end)
1150 {
1151 Some(unsafe { slice_unchecked(self, start, end) })
1152 } else {
1153 None
1154 }
1155 }
1156
1157 pub fn ends_with(&self, w: impl AsRef<Wtf8>) -> bool {
1158 self.bytes.ends_with_str(w.as_ref())

Callers 15

compileMethod · 0.45
add_instructionMethod · 0.45
compileMethod · 0.45
runMethod · 0.45
process_instructionMethod · 0.45
get_functionMethod · 0.45
is_child_ofFunction · 0.45
test_dbFunction · 0.45
is_code_point_boundaryFunction · 0.45
check_utf8_boundaryFunction · 0.45
generate_class_defFunction · 0.45

Calls 4

is_code_point_boundaryFunction · 0.85
slice_uncheckedFunction · 0.85
SomeClass · 0.50
lenMethod · 0.45

Tested by 6

compileMethod · 0.36
runMethod · 0.36
process_instructionMethod · 0.36
get_functionMethod · 0.36
test_dbFunction · 0.36