MCPcopy Create free account
hub / github.com/AI45Lab/Code / contains_bounded

Function contains_bounded

core/src/agent/auto_delegation.rs:256–262  ·  view source on GitHub ↗
(text: &str, needle: &str)

Source from the content-addressed store, hash-verified

254}
255
256fn contains_bounded(text: &str, needle: &str) -> bool {
257 text.match_indices(needle).any(|(idx, _)| {
258 let before = text[..idx].chars().next_back();
259 let after = text[idx + needle.len()..].chars().next();
260 is_reference_boundary(before) && is_reference_boundary(after)
261 })
262}
263
264fn is_reference_boundary(ch: Option<char>) -> bool {
265 ch.map(|ch| !ch.is_ascii_alphanumeric() && ch != '_' && ch != '-')

Callers 1

Calls 3

is_reference_boundaryFunction · 0.85
nextMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected