| 1 | OxIRI |
| 2 | ===== |
| 3 | |
| 4 | [](https://github.com/oxigraph/oxiri/actions) |
| 5 | [](https://crates.io/crates/oxiri) |
| 6 | [](https://docs.rs/oxiri) |
| 7 | |
| 8 | OxIRI is a simple and fast implementation of IRIs based on [RFC 3987](https://www.ietf.org/rfc/rfc3987.html). |
| 9 | |
| 10 | It allows zero stack allocation IRI validation and resolution. |
| 11 | |
| 12 | Example: |
| 13 | ```rust |
| 14 | use oxiri::Iri; |
| 15 | |
| 16 | // Parse and validate base IRI |
| 17 | let base_iri = Iri::parse("http://foo.com/bar/baz").unwrap(); |
| 18 | |
| 19 | // Validate and resolve relative IRI |
| 20 | let iri = base_iri.resolve("bat#foo").unwrap(); |
| 21 | assert_eq!("http://foo.com/bar/bat#foo", iri.as_str()); |
| 22 | |
| 23 | // Extract IRI components |
| 24 | assert_eq!(iri.scheme(), "http"); |
| 25 | assert_eq!(iri.authority(), Some("foo.com")); |
| 26 | assert_eq!(iri.path(), "/bar/bat"); |
| 27 | assert_eq!(iri.query(), None); |
| 28 | assert_eq!(iri.fragment(), Some("foo")); |
| 29 | ``` |
| 30 | |
| 31 | If [`serde`](https://serde.rs/) is available, `Iri` and `IriRef` implement the `Serialize` and `Deserialize` traits and encode the IRI as a string. |
| 32 | |
| 33 | |
| 34 | ## License |
| 35 | |
| 36 | This project is licensed under either of |
| 37 | |
| 38 | * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or |
| 39 | `<http://www.apache.org/licenses/LICENSE-2.0>`) |
| 40 | * MIT license ([LICENSE-MIT](LICENSE-MIT) or |
| 41 | `<http://opensource.org/licenses/MIT>`) |
| 42 | |
| 43 | at your option. |
| 44 | |
| 45 | |
| 46 | ### Contribution |
| 47 | |
| 48 | Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in OxIRI by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. |