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

Function token_boundary_ok

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

Source from the content-addressed store, hash-verified

513}
514
515fn token_boundary_ok(text: &str, abs_start: usize, token_end: usize, token: &str) -> bool {
516 if token.starts_with(PLACEHOLDER_PREFIX) {
517 return token_end == text.len()
518 || !is_env_key_char(text.as_bytes()[token_end])
519 || text[token_end..].starts_with(PLACEHOLDER_PREFIX);
520 }
521 let before_ok = abs_start == 0 || !is_alias_token_char(text.as_bytes()[abs_start - 1]);
522 let after_ok = token_end == text.len() || !is_alias_token_char(text.as_bytes()[token_end]);
523 before_ok && after_ok
524}
525
526pub fn placeholder_for_env_key(key: &str) -> String {
527 format!("{PLACEHOLDER_PREFIX}{key}")

Callers 1

Calls 3

is_env_key_charFunction · 0.85
is_alias_token_charFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected