https://github.com/andrefs/lax-oxiri
Lax development version of oxigraph/oxiri
https://github.com/andrefs/lax-oxiri
Last synced: 10 months ago
JSON representation
Lax development version of oxigraph/oxiri
- Host: GitHub
- URL: https://github.com/andrefs/lax-oxiri
- Owner: andrefs
- License: apache-2.0
- Created: 2023-02-15T22:44:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-29T10:01:51.000Z (about 3 years ago)
- Last Synced: 2025-02-26T08:15:28.677Z (over 1 year ago)
- Language: Rust
- Size: 56.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
OxIRI
=====
[](https://github.com/oxigraph/oxiri/actions)
[](https://crates.io/crates/oxiri)
[](https://docs.rs/oxiri)
OxIRI is a simple and fast implementation of IRIs based on [RFC 3987](https://www.ietf.org/rfc/rfc3987.html).
It allows zero stack allocation IRI validation and resolution.
Example:
```rust
use oxiri::Iri;
// Parse and validate base IRI
let base_iri = Iri::parse("http://foo.com/bar/baz").unwrap();
// Validate and resolve relative IRI
let iri = base_iri.resolve("bat#foo").unwrap();
assert_eq!("http://foo.com/bar/bat#foo", iri.as_str());
// Extract IRI components
assert_eq!(iri.scheme(), "http");
assert_eq!(iri.authority(), Some("foo.com"));
assert_eq!(iri.path(), "/bar/bat");
assert_eq!(iri.query(), None);
assert_eq!(iri.fragment(), Some("foo"));
```
If [`serde`](https://serde.rs/) is available, `Iri` and `IriRef` implement the `Serialize` and `Deserialize` traits and encode the IRI as a string.
## License
This project is licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
``)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
``)
at your option.
### Contribution
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.