pub struct OwnedName {
pub local_name: String,
pub namespace: Option<String>,
pub prefix: Option<String>,
}
Expand description
An owned variant of Name
.
Everything about Name
applies to this structure as well.
Fields
local_name: String
A local name, e.g. string
in xsi:string
.
namespace: Option<String>
A namespace URI, e.g. http://www.w3.org/2000/xmlns/
.
prefix: Option<String>
A name prefix, e.g. xsi
in xsi:string
.
Implementations
sourceimpl OwnedName
impl OwnedName
sourcepub fn local<S>(local_name: S) -> OwnedName where
S: Into<String>,
pub fn local<S>(local_name: S) -> OwnedName where
S: Into<String>,
Returns a new OwnedName
instance representing a plain local name.
sourcepub fn qualified<S1, S2, S3>(
local_name: S1,
namespace: S2,
prefix: Option<S3>
) -> OwnedName where
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
pub fn qualified<S1, S2, S3>(
local_name: S1,
namespace: S2,
prefix: Option<S3>
) -> OwnedName where
S1: Into<String>,
S2: Into<String>,
S3: Into<String>,
Returns a new OwnedName
instance representing a qualified name with or without
a prefix and with a namespace URI.
sourcepub fn prefix_ref(&self) -> Option<&str>
pub fn prefix_ref(&self) -> Option<&str>
Returns an optional prefix by reference, equivalent to self.borrow().prefix
but avoids extra work.
sourcepub fn namespace_ref(&self) -> Option<&str>
pub fn namespace_ref(&self) -> Option<&str>
Returns an optional namespace by reference, equivalen to self.borrow().namespace
but avoids extra work.
Trait Implementations
sourceimpl FromStr for OwnedName
impl FromStr for OwnedName
sourcefn from_str(s: &str) -> Result<OwnedName, ()>
fn from_str(s: &str) -> Result<OwnedName, ()>
Parses the given string slice into a qualified name.
This function, when finishes sucessfully, always return a qualified
name without a namespace (name.namespace == None
). It should be filled later
using proper NamespaceStack
.
It is supposed that all characters in the argument string are correct as defined by the XML specification. No additional checks except a check for emptiness are done.
impl Eq for OwnedName
impl StructuralEq for OwnedName
impl StructuralPartialEq for OwnedName
Auto Trait Implementations
impl RefUnwindSafe for OwnedName
impl Send for OwnedName
impl Sync for OwnedName
impl Unpin for OwnedName
impl UnwindSafe for OwnedName
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more