Expand description
A crate for handling URNs.
Features
serde
- Serde supportstd
(enabled by default) -std::error::Error
integrationnightly
- usecore::error::Error
rather thanstd::error::Error
. This allows using it without enabling thestd
feature. Warning: this feature will be removed when this gets stabilized and it won’t be considered a breaking change!alloc
(enabled by default) - alloc support (you probably want to keep this enabled)
Example
let urn = UrnBuilder::new("example", "1234:5678").build()?;
assert_eq!(urn.as_str(), "urn:example:1234:5678");
assert_eq!(urn, "urn:example:1234:5678".parse::<Urn>()?); // Using std::str::parse
assert_eq!(urn.nss(), "1234:5678");
Modules
- percent
alloc
This module contains functions for percent-encoding and decoding various components of a URN.
Structs
- Urn
alloc
An owned RFC2141/8141 URN (Uniform Resource Name). - UrnBuilder
alloc
A struct used for constructing URNs. - A borrowed RFC2141/8141 URN (Uniform Resource Name). This is a copy-on-write type.
Enums
- A URN validation error.