MCPcopy Create free account
hub / github.com/clawshell/clawshell / capture_quoted_token

Function capture_quoted_token

src/email.rs:691–716  ·  view source on GitHub ↗
(line: &str, key: &str)

Source from the content-addressed store, hash-verified

689}
690
691fn capture_quoted_token(line: &str, key: &str) -> Option<String> {
692 let marker = format!("{key} ");
693 let start = line.find(&marker)? + marker.len();
694 let rest = line[start..].trim_start();
695 let mut chars = rest.chars();
696 if chars.next()? != '"' {
697 return None;
698 }
699
700 let mut value = String::new();
701 let mut escaped = false;
702 for ch in chars {
703 if escaped {
704 value.push(ch);
705 escaped = false;
706 continue;
707 }
708 match ch {
709 '\\' => escaped = true,
710 '"' => return Some(value),
711 _ => value.push(ch),
712 }
713 }
714
715 None
716}
717
718fn capture_parenthesized_token(line: &str, key: &str) -> Option<String> {
719 let marker = format!("{key} ");

Callers 2

fetch_message_contentMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected