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

Method py_strip

crates/vm/src/anystr.rs:230–252  ·  view source on GitHub ↗
(
        &'a self,
        chars: OptionalOption<S>,
        func_chars: FC,
        func_default: FD,
    )

Source from the content-addressed store, hash-verified

228
229 #[inline]
230 fn py_strip<'a, S, FC, FD>(
231 &'a self,
232 chars: OptionalOption<S>,
233 func_chars: FC,
234 func_default: FD,
235 ) -> &'a Self
236 where
237 S: AnyStrWrapper<Self>,
238 FC: Fn(&'a Self, &Self) -> &'a Self,
239 FD: Fn(&'a Self) -> &'a Self,
240 {
241 let chars = chars.flatten();
242 match chars {
243 Some(chars) => {
244 if let Some(chars) = chars.as_ref() {
245 func_chars(self, chars)
246 } else {
247 self
248 }
249 }
250 None => func_default(self),
251 }
252 }
253
254 #[inline]
255 fn py_find<F>(&self, needle: &Self, range: Range<usize>, find: F) -> Option<usize>

Callers 6

stripMethod · 0.80
lstripMethod · 0.80
rstripMethod · 0.80
stripMethod · 0.80
lstripMethod · 0.80
rstripMethod · 0.80

Implementers 2

bytes_inner.rscrates/vm/src/bytes_inner.rs
str.rscrates/vm/src/builtins/str.rs

Calls 2

flattenMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected