Struct curie::Curie[][src]

pub struct Curie<'c> { /* fields omitted */ }

A prefix and reference, already parsed into separate components.

When parsing a document, the components of the compact URI will already have been parsed and we can avoid storing a string of the full compact URI and having to do that work again when expanding the compact URI.

The 'c lifetime parameter will typically be the lifetime of the body of text which is being parsed and contains the compact URIs.

Usage:

Creation:

let c = Curie::new(Some("foaf"), "Person");

Expansion:

Expanding a Curie requires the use of a properly initialized PrefixMapping.

// Initialize a prefix mapper.
let mut mapper = PrefixMapping::default();
mapper.add_prefix("foaf", "http://xmlns.com/foaf/0.1/").unwrap();

let curie = Curie::new(Some("foaf"), "Agent");

assert_eq!(mapper.expand_curie(&curie),
           Ok(String::from("http://xmlns.com/foaf/0.1/Agent")));

Display / Formatting:

Curie implements the Debug and Display traits, so it integrates with the Rust standard library facilities.

let curie = Curie::new(Some("foaf"), "Agent");
assert_eq!("foaf:Agent", format!("{}", curie));

Methods

impl<'c> Curie<'c>
[src]

Construct a Curie from a prefix and reference.

Trait Implementations

impl<'c> Debug for Curie<'c>
[src]

Formats the value using the given formatter. Read more

impl<'c> Eq for Curie<'c>
[src]

impl<'c> PartialEq for Curie<'c>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<'c> From<&'c Curie<'c>> for String
[src]

Performs the conversion.

impl<'c> From<Curie<'c>> for String
[src]

Performs the conversion.

impl<'c> Display for Curie<'c>
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'c> Send for Curie<'c>

impl<'c> Sync for Curie<'c>