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

Function create_match

crates/stdlib/src/re.rs:290–296  ·  view source on GitHub ↗

Take a found regular expression and convert it to proper match object.

(haystack: PyStrRef, captures: Captures)

Source from the content-addressed store, hash-verified

288
289 /// Take a found regular expression and convert it to proper match object.
290 fn create_match(haystack: PyStrRef, captures: Captures) -> PyMatch {
291 let captures = captures
292 .iter()
293 .map(|opt| opt.map(|m| m.start()..m.end()))
294 .collect();
295 PyMatch { haystack, captures }
296 }
297
298 fn extract_flags(flags: OptionalArg<usize>) -> PyRegexFlags {
299 flags.map_or_else(Default::default, PyRegexFlags::from_int)

Callers 2

do_matchFunction · 0.85
do_searchFunction · 0.85

Calls 5

collectMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected