pub struct NamespaceScope {
pub declarations: IndexMap<String, String>,
pub parent: Option<Box<NamespaceScope>>,
pub depth: usize,
}
Expand description
Namespace scope tracking for inheritance
Fields§
§declarations: IndexMap<String, String>
Active namespace declarations at this scope
parent: Option<Box<NamespaceScope>>
Parent scope for inheritance
depth: usize
Element depth for debugging
Implementations§
Source§impl NamespaceScope
impl NamespaceScope
Sourcepub fn declare_namespace(&mut self, prefix: String, uri: String)
pub fn declare_namespace(&mut self, prefix: String, uri: String)
Add a namespace declaration to this scope
Sourcepub fn resolve_prefix(&self, prefix: &str) -> Option<String>
pub fn resolve_prefix(&self, prefix: &str) -> Option<String>
Resolve a prefix to its URI, checking parent scopes
Sourcepub fn get_all_declarations(&self) -> IndexMap<String, String>
pub fn get_all_declarations(&self) -> IndexMap<String, String>
Get all active namespace declarations (including inherited)
Sourcepub fn is_namespace_declared(&self, uri: &str) -> bool
pub fn is_namespace_declared(&self, uri: &str) -> bool
Check if a namespace is declared in this scope or parents
Sourcepub fn find_prefix_for_uri(&self, uri: &str) -> Option<String>
pub fn find_prefix_for_uri(&self, uri: &str) -> Option<String>
Find the prefix for a namespace URI
Trait Implementations§
Source§impl Clone for NamespaceScope
impl Clone for NamespaceScope
Source§fn clone(&self) -> NamespaceScope
fn clone(&self) -> NamespaceScope
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for NamespaceScope
impl Debug for NamespaceScope
Auto Trait Implementations§
impl Freeze for NamespaceScope
impl RefUnwindSafe for NamespaceScope
impl Send for NamespaceScope
impl Sync for NamespaceScope
impl Unpin for NamespaceScope
impl UnwindSafe for NamespaceScope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more