(
&'a self,
text: &str,
abs_start: usize,
)
| 384 | } |
| 385 | |
| 386 | fn longest_known_token_match<'a>( |
| 387 | &'a self, |
| 388 | text: &str, |
| 389 | abs_start: usize, |
| 390 | ) -> Option<(usize, &'a str)> { |
| 391 | let suffix = &text[abs_start..]; |
| 392 | self.by_placeholder |
| 393 | .keys() |
| 394 | .filter_map(|placeholder| { |
| 395 | if !suffix.starts_with(placeholder) { |
| 396 | return None; |
| 397 | } |
| 398 | let key_end = abs_start + placeholder.len(); |
| 399 | let boundary_ok = token_boundary_ok(text, abs_start, key_end, placeholder); |
| 400 | boundary_ok.then_some((key_end, placeholder.as_str())) |
| 401 | }) |
| 402 | .max_by_key(|(_, placeholder)| placeholder.len()) |
| 403 | } |
| 404 | |
| 405 | /// Decode a Base64-encoded Basic auth token, resolve any placeholders in |
| 406 | /// the decoded `username:password` string, and re-encode. |
no test coverage detected