Crate urn

source ·
Expand description

A crate for handling URNs.

Features

  • serde - Serde support
  • std (enabled by default) - std::error::Error integration
  • nightly - use core::error::Error rather than std::error::Error. This allows using it without enabling the std 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

  • 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).
  • 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.