MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / build

Function build

std/re/src/main/mod.rs:117–125  ·  view source on GitHub ↗
(chars: &[char], caps: &Caps, ngroups: usize)

Source from the content-addressed store, hash-verified

115}
116
117fn build(chars: &[char], caps: &Caps, ngroups: usize) -> Found {
118 let (s, e) = caps[0].unwrap();
119 let text: String = chars[s..e].iter().collect();
120 let mut groups = Vec::with_capacity(ngroups);
121 for i in 1..=ngroups {
122 groups.push(caps.get(i).copied().flatten().map(|(a, b)| chars[a..b].iter().collect()));
123 }
124 Found { start: s, end: e, text, groups }
125}
126
127/* Expand a replacement template against the captured groups. */
128fn expand(repl: &[char], chars: &[char], caps: &Caps, names: &[(String, usize)], out: &mut String) -> Result<(), ReError> {

Callers 2

findFunction · 0.85
find_allFunction · 0.85

Calls 4

collectMethod · 0.80
pushMethod · 0.80
iterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected