[−][src]Struct xml_string::names::ParsedQname
Parsed QName
reference.
Implementations
impl<'a> ParsedQname<'a>
[src]
pub fn from_str(s: &'a str) -> Result<Self, NameError>
[src]
Creates a new ParsedQname<'_>
from the given string slice.
Failures
Fails if the given string is not a valid QName
.
Examples
let noprefix = ParsedQname::from_str("hello")?; assert_eq!(noprefix, "hello"); let prefixed = ParsedQname::from_str("foo:bar")?; assert_eq!(prefixed, "foo:bar"); assert!(ParsedQname::from_str("").is_err(), "Empty string is not a QName"); assert!(ParsedQname::from_str("foo bar").is_err(), "Whitespace is not allowed"); assert!(ParsedQname::from_str("foo:bar:baz").is_err(), "Two or more colons are not allowed"); assert!(ParsedQname::from_str("0foo").is_err(), "ASCII digit at the beginning is not allowed");
#[must_use]pub fn as_qname(&self) -> &'a Qname
[src]
Returns the string as &Qname
.
Exmaples
use xml_string::names::Qname; let name = ParsedQname::from_str("hello")?; assert_eq!(name, "hello"); let s: &Qname = name.as_qname(); assert_eq!(s, "hello");
#[must_use]pub fn as_str(&self) -> &'a str
[src]
Returns the string as &str
.
Exmaples
let name = ParsedQname::from_str("hello")?; assert_eq!(name, "hello"); let s: &str = name.as_str(); assert_eq!(s, "hello");
#[must_use]pub fn has_prefix(&self) -> bool
[src]
Returns whether the QName has a prefix.
Examples
let local_only = ParsedQname::from_str("hello")?; assert!(!local_only.has_prefix()); let prefixed = ParsedQname::from_str("foo:bar")?; assert!(prefixed.has_prefix());
#[must_use]pub fn prefix(&self) -> Option<&'a Ncname>
[src]
Returns the prefix, if available.
Examples
let prefixed = ParsedQname::from_str("foo:bar")?; assert_eq!(prefixed.prefix().map(|s| s.as_str()), Some("foo")); let noprefix = ParsedQname::from_str("foo")?; assert_eq!(noprefix.prefix().map(|s| s.as_str()), None);
#[must_use]pub fn local_part(&self) -> &'a Ncname
[src]
Returns the local part.
Examples
let prefixed = ParsedQname::from_str("foo:bar")?; assert_eq!(prefixed.local_part(), "bar"); let noprefix = ParsedQname::from_str("foo")?; assert_eq!(noprefix.local_part(), "foo");
#[must_use]pub fn prefix_and_local(&self) -> (Option<&'a Ncname>, &'a Ncname)
[src]
Returns a pair of the prefix (if available) and the local part.
This is efficient version of (self.prefix(), self.local_part())
.
Examples
use std::convert::TryFrom; let noprefix = ParsedQname::from_str("hello")?; assert_eq!(noprefix.prefix_and_local(), (noprefix.prefix(), noprefix.local_part())); let prefixed = ParsedQname::from_str("foo:bar")?; assert_eq!(prefixed.prefix_and_local(), (prefixed.prefix(), prefixed.local_part()));
Trait Implementations
impl<'_> AsRef<Qname> for ParsedQname<'_>
[src]
impl<'_> AsRef<str> for ParsedQname<'_>
[src]
impl<'a> Clone for ParsedQname<'a>
[src]
pub fn clone(&self) -> ParsedQname<'a>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a> Copy for ParsedQname<'a>
[src]
impl<'_> Debug for ParsedQname<'_>
[src]
impl<'_> Display for ParsedQname<'_>
[src]
impl<'a> Eq for ParsedQname<'a>
[src]
impl<'a> From<&'a Qname> for ParsedQname<'a>
[src]
impl<'a> From<ParsedQname<'a>> for &'a Qname
[src]
pub fn from(s: ParsedQname<'a>) -> Self
[src]
impl<'a> Hash for ParsedQname<'a>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> Ord for ParsedQname<'a>
[src]
pub fn cmp(&self, other: &ParsedQname<'a>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<'_, '_> PartialEq<&'_ ParsedQname<'_>> for str
[src]
pub fn eq(&self, o: &&ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<&'_ String> for ParsedQname<'_>
[src]
pub fn eq(&self, other: &&String) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<&'_ str> for ParsedQname<'_>
[src]
pub fn eq(&self, other: &&str) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<Box<str, Global>> for ParsedQname<'_>
[src]
pub fn eq(&self, other: &Box<str>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<Cow<'_, str>> for ParsedQname<'_>
[src]
pub fn eq(&self, other: &Cow<'_, str>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<ParsedQname<'_>> for str
[src]
pub fn eq(&self, o: &ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<ParsedQname<'_>> for &'_ str
[src]
pub fn eq(&self, o: &ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<ParsedQname<'_>> for String
[src]
pub fn eq(&self, o: &ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<ParsedQname<'_>> for &'_ String
[src]
pub fn eq(&self, o: &ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<ParsedQname<'_>> for Box<str>
[src]
pub fn eq(&self, o: &ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<ParsedQname<'_>> for Cow<'_, str>
[src]
pub fn eq(&self, o: &ParsedQname<'_>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialEq<ParsedQname<'a>> for ParsedQname<'a>
[src]
pub fn eq(&self, other: &ParsedQname<'a>) -> bool
[src]
pub fn ne(&self, other: &ParsedQname<'a>) -> bool
[src]
impl<'_> PartialEq<String> for ParsedQname<'_>
[src]
pub fn eq(&self, other: &String) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<str> for ParsedQname<'_>
[src]
pub fn eq(&self, other: &str) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialEq<str> for &'_ ParsedQname<'_>
[src]
pub fn eq(&self, other: &str) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialOrd<&'_ ParsedQname<'_>> for str
[src]
pub fn partial_cmp(&self, o: &&ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<ParsedQname<'_>> for str
[src]
pub fn partial_cmp(&self, o: &ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialOrd<ParsedQname<'_>> for &'_ str
[src]
pub fn partial_cmp(&self, o: &ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<ParsedQname<'_>> for String
[src]
pub fn partial_cmp(&self, o: &ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialOrd<ParsedQname<'_>> for &'_ String
[src]
pub fn partial_cmp(&self, o: &ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialOrd<ParsedQname<'_>> for Box<str>
[src]
pub fn partial_cmp(&self, o: &ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_, '_> PartialOrd<ParsedQname<'_>> for Cow<'_, str>
[src]
pub fn partial_cmp(&self, o: &ParsedQname<'_>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'a> PartialOrd<ParsedQname<'a>> for ParsedQname<'a>
[src]
pub fn partial_cmp(&self, other: &ParsedQname<'a>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &ParsedQname<'a>) -> bool
[src]
pub fn le(&self, other: &ParsedQname<'a>) -> bool
[src]
pub fn gt(&self, other: &ParsedQname<'a>) -> bool
[src]
pub fn ge(&self, other: &ParsedQname<'a>) -> bool
[src]
impl<'a> StructuralEq for ParsedQname<'a>
[src]
impl<'a> StructuralPartialEq for ParsedQname<'a>
[src]
impl<'a> TryFrom<&'a str> for ParsedQname<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for ParsedQname<'a>
impl<'a> Send for ParsedQname<'a>
impl<'a> Sync for ParsedQname<'a>
impl<'a> Unpin for ParsedQname<'a>
impl<'a> UnwindSafe for ParsedQname<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,