Namespace

Struct Namespace 

Source
pub struct Namespace { /* private fields */ }
Expand description

Namespace is a set of namespace prefixes and URIs, and mappings between them, that have been encountered or are defaults.

It also contains a stack of active mappings

More complex implementations will move to using BTree for the prefixes

Implementations§

Source§

impl Namespace

Source

pub fn new(xmlns: bool) -> Self

Create a new Namespace object

Source

pub fn uses_xmlns(&self) -> bool

Returns true if the Namespace was constructed indicating it should provide the standard XMLNS

Source

pub fn find_name(&mut self, name: &str) -> Option<NSNameId>

Find a name within the Namespace; return a None if not found, or Some(NSNameId) if it is. An empty name is an NSNameId::None

Source

pub fn find_prefix(&mut self, prefix: &str) -> Option<NSPrefixId>

Find a prefix within the Namespace; return a None if not found, or Some(NSPrefixId) if it is. An empty name is an NSPrefixId::None

Source

pub fn find_uri(&mut self, uri: &str) -> Option<NSUriId>

Find a URI within the Namespace; return a None if not found, or Some(NSUriId) if it is. An empty name is an NSUriId::None

Source

pub fn name_str<'a>(&'a self, name: NSNameId, default: &'a str) -> &'a str

Borrow the str of a NSNameId within the Namespace

Source

pub fn prefix_str<'a>(&'a self, prefix: NSPrefixId, default: &'a str) -> &'a str

Borrow the str of a NSPrefixId within the Namespace

Source

pub fn uri_str<'a>(&'a self, uri: NSUriId, default: &'a str) -> &'a str

Borrow the str of a NSUriId within the Namespace

Source

pub fn add_mapping(&mut self, prefix: &str, uri: &str) -> NSMap

Add a mapping from a prefix to a URI

Source

pub fn add_mapping_by_id( &mut self, prefix_id: NSPrefixId, uri_id: NSUriId, ) -> NSMap

Add a mapping from a prefix to a URI

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.