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

Method trim_start_matches

crates/wtf8/src/lib.rs:1076–1090  ·  view source on GitHub ↗
(&self, f: impl Fn(CodePoint) -> bool)

Source from the content-addressed store, hash-verified

1074 }
1075
1076 pub fn trim_start_matches(&self, f: impl Fn(CodePoint) -> bool) -> &Self {
1077 let mut iter = self.code_points();
1078 loop {
1079 let old = iter.clone();
1080 match iter.next().map(&f) {
1081 Some(true) => continue,
1082 Some(false) => {
1083 iter = old;
1084 break;
1085 }
1086 None => return iter.as_wtf8(),
1087 }
1088 }
1089 iter.as_wtf8()
1090 }
1091
1092 pub fn trim_end_matches(&self, f: impl Fn(CodePoint) -> bool) -> &Self {
1093 let mut iter = self.code_points();

Callers 8

write_syntaxerrorMethod · 0.80
get_size_from_formatFunction · 0.80
format_to_ffi_typeMethod · 0.80
get_field_formatFunction · 0.80
lstripMethod · 0.80
mangle_nameFunction · 0.80
trim_matchesMethod · 0.80
mangle_nameFunction · 0.80

Calls 5

code_pointsMethod · 0.80
cloneMethod · 0.45
mapMethod · 0.45
nextMethod · 0.45
as_wtf8Method · 0.45

Tested by

no test coverage detected