Skip to main content

Crate urn_rs

Crate urn_rs 

Source
Expand description

A crate for handling URNs.

Features

  • serde - Serde support
  • std (enabled by default) - std::error::Error integration
  • 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§

percentalloc
This module contains functions for percent-encoding and decoding various components of a URN.

Structs§

Urnalloc
An owned RFC2141/8141 URN (Uniform Resource Name).
UrnBuilderalloc
A struct used for constructing URNs.
UrnSlice
A borrowed RFC2141/8141 URN (Uniform Resource Name). This is a copy-on-write type.

Enums§

Error
A URN validation error.