MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / canonical_token_at

Function canonical_token_at

crates/openshell-core/src/secrets.rs:445–455  ·  view source on GitHub ↗
(text: &str, abs_start: usize)

Source from the content-addressed store, hash-verified

443}
444
445fn canonical_token_at(text: &str, abs_start: usize) -> Option<(usize, &str)> {
446 if !text[abs_start..].starts_with(PLACEHOLDER_PREFIX) {
447 return None;
448 }
449 let key_start = abs_start + PLACEHOLDER_PREFIX.len();
450 let key_end = text[key_start..]
451 .bytes()
452 .position(|b| !is_env_key_char(b))
453 .map_or(text.len(), |p| key_start + p);
454 (key_end > key_start).then_some((key_end, &text[abs_start..key_end]))
455}
456
457fn alias_token_at(text: &str, abs_start: usize) -> Option<(usize, &str)> {
458 let suffix = &text[abs_start..];

Callers 2

credential_token_atMethod · 0.85
rewrite_path_segmentFunction · 0.85

Calls 2

is_env_key_charFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected