MCPcopy Create free account
hub / github.com/denoland/rust-urlpattern / is_search_prefix

Method is_search_prefix

src/constructor_parser.rs:60–78  ·  view source on GitHub ↗

Ref: https://wicg.github.io/urlpattern/#is-a-search-prefix

(&self)

Source from the content-addressed store, hash-verified

58
59 // Ref: https://wicg.github.io/urlpattern/#is-a-search-prefix
60 fn is_search_prefix(&self) -> bool {
61 if self.is_non_special_pattern_char(self.token_index, "?") {
62 return true;
63 }
64 if self.token_list[self.token_index].value != "?" {
65 return false;
66 }
67 if self.token_index == 0 {
68 return true;
69 }
70 let previous_token = self.get_safe_token(self.token_index - 1);
71 !matches!(
72 previous_token.kind,
73 TokenType::Name
74 | TokenType::Regexp
75 | TokenType::Close
76 | TokenType::Asterisk
77 )
78 }
79
80 // Ref: https://wicg.github.io/urlpattern/#is-a-password-prefix
81 #[inline]

Callers 1

parse_constructor_stringFunction · 0.80

Calls 2

get_safe_tokenMethod · 0.80

Tested by

no test coverage detected