iri-rs-core
Core types and parser for the iri-rs workspace. Fork of iref by Timothée Haudebourg. URI and IRI parsing, component access, in-place mutation, reference resolution, normalization, equivalence.
foo://user@example.com:8042/over/there?name=ferret#nose
└┬┘ └──────────┬────────┘└────┬────┘└────┬─────┘└┬─┘
│ │ │ │ │
scheme authority path query fragment
Most users should depend on the facade crate iri-rs instead. Depend on iri-rs-core directly only if you want none of the optional features from the facade — or if you're building another crate on top (the iri-rs-static and iri-rs-enum proc-macros emit paths against ::iri_rs_core, so downstream crates using them must have this crate as a direct dependency).
use ;
let iri = parse?;
assert_eq!;
let mut buf = new?;
buf.set_path?;
assert_eq!;
Install
Feature flags
| Flag | Default | Enables |
|---|---|---|
serde |
Serialize / Deserialize for borrowed and owned types |
|
fast-hash |
Skip re-parse on Hash — trades stricter invariants for speed |
What's inside
Iri/IriBuf,IriRef/IriRefBuf— IRIs and IRI references (RFC 3987).Uri/UriBuf,UriRef/UriRefBuf— URIs and URI references (RFC 3986).Positions— pre-computed component ends. Used byfrom_raw_partsfor const construction iniri-rs-staticandiri-rs-enum.- Strict RFC 3986 §5 reference resolution with Errata 4547.
- Path normalization, protocol-agnostic equivalence, percent-decoding-aware comparison via
pct.
Performance notes
simdutf8for fast UTF-8 validation.memchrfor%and delimiter scans.- SWAR / byte-level fast paths on
new,eq,ord,hash,len. smallvecfor small-path accumulation in resolution / normalization.
Benchmarks
Covers parse, accessors, resolve, normalize, mutate, normalize_eq, validate. Criterion output: target/criterion/.
Workspace
Part of the iri-rs workspace. See the root README for the overall picture, motivation, and fork attribution.
MSRV
Rust 1.85 (edition 2024).
License
Dual-licensed: