MCPcopy Index your code
hub / github.com/denoland/rust-urlpattern

github.com/denoland/rust-urlpattern @0.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.6.0 ↗ · + Follow
161 symbols 290 edges 12 files 63 documented · 39%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

urlpattern

This crate implements the URLPattern web API in Rust. We aim to follow the specification as closely as possible.

Example

use urlpattern::UrlPattern;
use urlpattern::UrlPatternInit;
use urlpattern::UrlPatternMatchInput;

fn main() {
  // Create the UrlPattern to match against.
  let init = UrlPatternInit {
    pathname: Some("/users/:id".to_owned()),
    ..Default::default()
  };
  let pattern = <UrlPattern>::parse(init, Default::default()).unwrap();

  // Match the pattern against a URL.
  let url = "https://example.com/users/123".parse().unwrap();
  let result = pattern.exec(UrlPatternMatchInput::Url(url)).unwrap().unwrap();
  assert_eq!(result.pathname.groups.get("id").unwrap().as_ref().unwrap(), "123");
}

Contributing

We appreciate your help!

The code of conduct from the Deno repository applies here too: https://github.com/denoland/deno/blob/main/.github/CODE_OF_CONDUCT.md.

Extension points exported contracts — how you extend this code

RegExp (Interface)
(no doc) [2 implementers]
src/regexp.rs

Core symbols most depended-on inside this repo

change_state
called by 18
src/constructor_parser.rs
try_consume_token
called by 12
src/parser.rs
is_non_special_pattern_char
called by 11
src/constructor_parser.rs
optionally_transpose_regex_error
called by 10
src/component.rs
make_component_string
called by 9
src/constructor_parser.rs
process_tokenizing_error
called by 9
src/tokenizer.rs
process_base_url
called by 8
src/canonicalize_and_process.rs
create_match_result
called by 8
src/component.rs

Shape

Method 71
Function 49
Class 23
Enum 17
Interface 1

Languages

Rust100%

Modules by API surface

src/lib.rs41 symbols
src/canonicalize_and_process.rs23 symbols
src/parser.rs22 symbols
src/constructor_parser.rs22 symbols
src/quirks.rs18 symbols
src/tokenizer.rs12 symbols
src/component.rs9 symbols
src/regexp.rs5 symbols
src/error.rs4 symbols
src/matcher.rs3 symbols
fuzz/fuzz_targets/fuzz_parse.rs1 symbols
benches/parse_patterns.rs1 symbols

For agents

$ claude mcp add rust-urlpattern \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact