[−][src]Struct xml_string::names::UriQualifiedName
String slice for URIQualifiedName.
Implementations
impl UriQualifiedName[src]
pub fn from_str(s: &str) -> Result<&Self, NameError>[src]
Creates a new &UriQualifiedName.
URIQualifiedName has Q{uri}ncname format.
UriQualifiedName type validates NCName part, but does not validate URI part.
In most contexts, processors are not required to raise errors if a URI is not lexically valid according to RFC3986 and RFC3987. See 2.4.5 URI Literals for details.
XPath 3.1 requires a statically known, valid URI in a BracedURILiteral. An implementation may raise a static error err:XQST0046 if the value of a Braced URI Literal is of nonzero length and is neither an absolute URI nor a relative URI.
It is user's responsibility to validate URI part if necessary.
Failures
Fails if the given string is not a valid UriQualifiedName.
Examples
let name = UriQualifiedName::from_str("Q{http://example.com/}name")?; assert_eq!(name, "Q{http://example.com/}name"); assert_eq!( UriQualifiedName::from_str("Q{}name")?, "Q{}name", "Empty URI is OK" ); assert_eq!( UriQualifiedName::from_str("Q{foo}bar")?, "Q{foo}bar", "URI is not validated" ); assert!( UriQualifiedName::from_str("foo").is_err(), "URIQualifiedName has `Q{{uri}}ncname` format" ); assert!( UriQualifiedName::from_str("Q{http://example.com}foo:bar").is_err(), "Colon is not allowed" ); assert!( UriQualifiedName::from_str("Q{foo{bar}qux").is_err(), "URI part cannot have `{{` and `}}`" );
#[must_use]pub unsafe fn new_unchecked(s: &str) -> &Self[src]
Creates a new &UriQualifiedName without validation.
Safety
The given string should be a valid UriQualifiedName.
Examples
let name = unsafe { UriQualifiedName::new_unchecked("Q{foo}bar") }; assert_eq!(name, "Q{foo}bar");
#[must_use]pub fn as_str(&self) -> &str[src]
Returns the string as &str.
Examples
let name = UriQualifiedName::from_str("Q{foo}bar")?; assert_eq!(name, "Q{foo}bar"); let s: &str = name.as_str(); assert_eq!(s, "Q{foo}bar");
pub fn parse_next(s: &str) -> Result<(&Self, &str), NameError>[src]
Parses the leading UriQualifiedName and returns the value and the rest input.
Exmaples
let input = "Q{foo}bar:012"; let expected = UriQualifiedName::from_str("Q{foo}bar") .expect("valid UriQualifiedName"); assert_eq!( UriQualifiedName::parse_next(input), Ok((expected, ":012")) );
let input = "012"; assert!(UriQualifiedName::parse_next(input).is_err());
#[must_use]pub fn uri(&self) -> &str[src]
Returns the URI.
Note that this is O(length) operation.
Consider using ParsedUriQualifiedName::uri method if possible.
Examples
let name = UriQualifiedName::from_str("Q{foo}bar")?; assert_eq!(name.uri(), "foo"); let empty_uri = UriQualifiedName::from_str("Q{}foo")?; assert_eq!(empty_uri.uri(), "");
#[must_use]pub fn local_name(&self) -> &Ncname[src]
Returns the local name.
Note that this is O(length) operation.
Consider using ParsedUriQualifiedName::local_name method if possible.
Examples
let name = UriQualifiedName::from_str("Q{foo}bar")?; assert_eq!(name.local_name(), "bar");
#[must_use]pub fn uri_and_local(&self) -> (&str, &Ncname)[src]
Returns a pair of the uri and the local name.
Note that this is O(length) operation.
Consider using ParsedUriQualifiedName::uri_and_local method if possible.
Examples
use std::convert::TryFrom; let name = UriQualifiedName::from_str("Q{foo}bar")?; assert_eq!(name.uri_and_local(), (name.uri(), name.local_name()));
pub fn into_boxed_str(self: Box<Self>) -> Box<str>[src]
Converts a Box<UriQualifiedName> into a Box<str> without copying or allocating.
Examples
let name = UriQualifiedName::from_str("Q{foo}bar")?; let boxed_name: Box<UriQualifiedName> = name.into(); assert_eq!(&*boxed_name, name); let boxed_str: Box<str> = boxed_name.into_boxed_str(); assert_eq!(&*boxed_str, name.as_str());
Trait Implementations
impl AsRef<UriQualifiedName> for UriQualifiedName[src]
pub fn as_ref(&self) -> &UriQualifiedName[src]
impl<'_> AsRef<UriQualifiedName> for ParsedUriQualifiedName<'_>[src]
pub fn as_ref(&self) -> &UriQualifiedName[src]
impl AsRef<str> for UriQualifiedName[src]
impl<'_> Debug for &'_ UriQualifiedName[src]
impl<'_> Display for &'_ UriQualifiedName[src]
impl Eq for UriQualifiedName[src]
impl<'_> From<&'_ UriQualifiedName> for Box<UriQualifiedName>[src]
pub fn from(s: &UriQualifiedName) -> Self[src]
impl<'_> From<&'_ UriQualifiedName> for Rc<UriQualifiedName>[src]
pub fn from(s: &UriQualifiedName) -> Self[src]
impl<'_> From<&'_ UriQualifiedName> for Arc<UriQualifiedName>[src]
pub fn from(s: &UriQualifiedName) -> Self[src]
impl<'a> From<&'a UriQualifiedName> for ParsedUriQualifiedName<'a>[src]
pub fn from(s: &'a UriQualifiedName) -> Self[src]
impl<'a> From<ParsedUriQualifiedName<'a>> for &'a UriQualifiedName[src]
pub fn from(s: ParsedUriQualifiedName<'a>) -> Self[src]
impl Hash for UriQualifiedName[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 Ord for UriQualifiedName[src]
pub fn cmp(&self, other: &UriQualifiedName) -> Ordering[src]
#[must_use]pub fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
impl<'_> PartialEq<&'_ String> for UriQualifiedName[src]
pub fn eq(&self, o: &&String) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<&'_ UriQualifiedName> for str[src]
pub fn eq(&self, o: &&UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<&'_ str> for UriQualifiedName[src]
impl PartialEq<Box<str, Global>> for UriQualifiedName[src]
pub fn eq(&self, o: &Box<str>) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<Cow<'_, str>> for UriQualifiedName[src]
pub fn eq(&self, o: &Cow<'_, str>) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialEq<String> for UriQualifiedName[src]
impl PartialEq<UriQualifiedName> for UriQualifiedName[src]
pub fn eq(&self, other: &UriQualifiedName) -> bool[src]
pub fn ne(&self, other: &UriQualifiedName) -> bool[src]
impl PartialEq<UriQualifiedName> for str[src]
pub fn eq(&self, o: &UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<UriQualifiedName> for &'_ str[src]
pub fn eq(&self, o: &UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialEq<UriQualifiedName> for String[src]
pub fn eq(&self, o: &UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<UriQualifiedName> for &'_ String[src]
pub fn eq(&self, o: &UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialEq<UriQualifiedName> for Box<str>[src]
pub fn eq(&self, o: &UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialEq<UriQualifiedName> for Cow<'_, str>[src]
pub fn eq(&self, o: &UriQualifiedName) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialEq<str> for UriQualifiedName[src]
impl<'_> PartialEq<str> for &'_ UriQualifiedName[src]
impl<'_> PartialOrd<&'_ String> for UriQualifiedName[src]
pub fn partial_cmp(&self, o: &&String) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ UriQualifiedName> for str[src]
pub fn partial_cmp(&self, o: &&UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<&'_ str> for UriQualifiedName[src]
pub fn partial_cmp(&self, o: &&str) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<Box<str, Global>> for UriQualifiedName[src]
pub fn partial_cmp(&self, o: &Box<str>) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<Cow<'_, str>> for UriQualifiedName[src]
pub fn partial_cmp(&self, o: &Cow<'_, str>) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<String> for UriQualifiedName[src]
pub fn partial_cmp(&self, o: &String) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<UriQualifiedName> for UriQualifiedName[src]
pub fn partial_cmp(&self, other: &UriQualifiedName) -> Option<Ordering>[src]
pub fn lt(&self, other: &UriQualifiedName) -> bool[src]
pub fn le(&self, other: &UriQualifiedName) -> bool[src]
pub fn gt(&self, other: &UriQualifiedName) -> bool[src]
pub fn ge(&self, other: &UriQualifiedName) -> bool[src]
impl PartialOrd<UriQualifiedName> for str[src]
pub fn partial_cmp(&self, o: &UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<UriQualifiedName> for &'_ str[src]
pub fn partial_cmp(&self, o: &UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<UriQualifiedName> for String[src]
pub fn partial_cmp(&self, o: &UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<UriQualifiedName> for &'_ String[src]
pub fn partial_cmp(&self, o: &UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<UriQualifiedName> for Box<str>[src]
pub fn partial_cmp(&self, o: &UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<UriQualifiedName> for Cow<'_, str>[src]
pub fn partial_cmp(&self, o: &UriQualifiedName) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl PartialOrd<str> for UriQualifiedName[src]
pub fn partial_cmp(&self, o: &str) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl<'_> PartialOrd<str> for &'_ UriQualifiedName[src]
pub fn partial_cmp(&self, o: &str) -> Option<Ordering>[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for UriQualifiedName[src]
impl StructuralPartialEq for UriQualifiedName[src]
impl ToOwned for UriQualifiedName[src]
type Owned = Box<UriQualifiedName>
The resulting type after obtaining ownership.