pub struct QualName {
pub prefix: Option<Atom<PrefixStaticSet>>,
pub ns: Atom<NamespaceStaticSet>,
pub local: Atom<LocalNameStaticSet>,
}
Expand description
A fully qualified name (with a namespace), used to depict names of tags and attributes.
Namespaces can be used to differentiate between similar XML fragments. For example:
// HTML
<table>
<tr>
<td>Apples</td>
<td>Bananas</td>
</tr>
</table>
// Furniture XML
<table>
<name>African Coffee Table</name>
<width>80</width>
<length>120</length>
</table>
Without XML namespaces, we can’t use those two fragments in the same document at the same time. However if we declare a namespace we could instead say:
// Furniture XML
<furn:table>
<furn:name>African Coffee Table</furn:name>
<furn:width>80</furn:width>
<furn:length>120</furn:length>
</furn:table>
and bind the prefix furn
to a different namespace.
For this reason we parse names that contain a colon in the following way:
<furn:table>
| |
| +- local name
|
prefix (when resolved gives namespace_url)
Fields
prefix: Option<Atom<PrefixStaticSet>>
The namespace before resolution (e.g. furn
in <furn:table>
above).
ns: Atom<NamespaceStaticSet>
The namespace after resolution.
local: Atom<LocalNameStaticSet>
The local name (e.g. table
in <furn:table>
above).
Implementations
sourceimpl QualName
impl QualName
sourcepub fn new(
prefix: Option<Atom<PrefixStaticSet>>,
ns: Atom<NamespaceStaticSet>,
local: Atom<LocalNameStaticSet>
) -> QualName
pub fn new(
prefix: Option<Atom<PrefixStaticSet>>,
ns: Atom<NamespaceStaticSet>,
local: Atom<LocalNameStaticSet>
) -> QualName
Simple constructor function.
sourcepub fn expanded(&self) -> ExpandedName<'_>
pub fn expanded(&self) -> ExpandedName<'_>
Take a reference of self
as an ExpandedName
, dropping the unresolved prefix.
Trait Implementations
sourceimpl Ord for QualName
impl Ord for QualName
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<QualName> for QualName
impl PartialOrd<QualName> for QualName
sourcefn partial_cmp(&self, other: &QualName) -> Option<Ordering>
fn partial_cmp(&self, other: &QualName) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for QualName
impl StructuralEq for QualName
impl StructuralPartialEq for QualName
Auto Trait Implementations
impl RefUnwindSafe for QualName
impl Send for QualName
impl Sync for QualName
impl Unpin for QualName
impl UnwindSafe for QualName
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more