Skip to main content

Crate use_uri

Crate use_uri 

Source
Expand description

§use-uri

Small URI utility primitives for RustUse.

§Experimental

use-uri is experimental while the use-web workspace remains below 0.3.0. Expect API adjustments as the first wave settles.

§Example

use use_uri::{extract_query, parse_uri_basic};

let parts = parse_uri_basic("https://example.com/docs?page=2#intro");

assert_eq!(parts.scheme.as_deref(), Some("https"));
assert_eq!(parts.authority.as_deref(), Some("example.com"));
assert_eq!(extract_query("https://example.com/docs?page=2#intro").as_deref(), Some("page=2"));

§Scope

  • Small helpers for URI inspection and string-based splitting.
  • Basic extraction for schemes, authorities, queries, and fragments.
  • Predictable behavior for malformed or partial input.

§Non-goals

  • Full RFC URI parsing.
  • URL normalization.
  • IDNA handling.

§License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

Structs§

UriParts
Basic URI parts extracted with lightweight string splitting.

Functions§

extract_fragment
Extracts the fragment without the leading # when present.
extract_query
Extracts the query without the leading ? and excluding any fragment.
extract_scheme
Extracts a lowercase URI scheme when the input starts with one.
has_scheme
Returns true when the input begins with a valid URI scheme.
looks_like_uri
Returns true when the input starts with a valid URI scheme or authority marker.
parse_uri_basic
Parses URI-like input with lightweight splitting and graceful fallback behavior.
strip_fragment
Returns the input without the fragment portion.
strip_query
Returns the input without the query portion.