MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / matches_pattern_recursive

Method matches_pattern_recursive

atomic-identity/src/delegation.rs:275–289  ·  view source on GitHub ↗
(pattern: &[char], value: &[char])

Source from the content-addressed store, hash-verified

273 }
274
275 fn matches_pattern_recursive(pattern: &[char], value: &[char]) -> bool {
276 match (pattern.first(), value.first()) {
277 (None, None) => true,
278 (Some('*'), _) => {
279 // Try matching zero or more characters
280 Self::matches_pattern_recursive(&pattern[1..], value)
281 || (!value.is_empty() && Self::matches_pattern_recursive(pattern, &value[1..]))
282 }
283 (Some('?'), Some(_)) => Self::matches_pattern_recursive(&pattern[1..], &value[1..]),
284 (Some(p), Some(v)) if p == v => {
285 Self::matches_pattern_recursive(&pattern[1..], &value[1..])
286 }
287 _ => false,
288 }
289 }
290}
291
292/// Builder for creating delegation scopes.

Callers

nothing calls this directly

Calls 1

is_emptyMethod · 0.45

Tested by

no test coverage detected