#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(not(feature = "std"))]
extern crate alloc;
#[cfg(not(feature = "std"))]
use alloc::borrow::Cow;
#[cfg(feature = "std")]
use std::borrow::Cow;
use super::error::UrnValidationError;
pub trait UrnComponents<'a> {
fn get_component(&self, key: &'static str) -> Option<&Cow<'a, str>>;
fn set_component(&mut self, key: &'static str, value: Cow<'a, str>);
fn remove_component(&mut self, key: &'static str) -> Option<Cow<'a, str>>;
#[cfg(feature = "std")]
fn iter(&self) -> Box<dyn Iterator<Item = (&'static str, &Cow<'a, str>)> + '_>;
#[cfg(not(feature = "std"))]
fn iter(&self) -> alloc::boxed::Box<dyn Iterator<Item = (&'static str, &Cow<'a, str>)> + '_>;
#[cfg(feature = "std")]
fn iter_mut(&mut self) -> Box<dyn Iterator<Item = (&'static str, &mut Cow<'a, str>)> + '_>;
#[cfg(not(feature = "std"))]
fn iter_mut(&mut self) -> alloc::boxed::Box<dyn Iterator<Item = (&'static str, &mut Cow<'a, str>)> + '_>;
}
pub trait UrnSpec {
const NID: &'static str;
fn transform<'a>(components: &mut dyn UrnComponents<'a>) {
let _ = components;
}
fn validate<'a>(components: &dyn UrnComponents<'a>) -> Result<(), UrnValidationError>;
fn build_nss<'a>(components: &dyn UrnComponents<'a>) -> Result<Cow<'static, str>, UrnValidationError>;
}