[−][src]Struct xml_string::names::Name
String slice for Name
.
Implementations
impl Name
[src]
pub fn from_str(s: &str) -> Result<&Self, NameError>
[src]
Creates a new &Name
.
Failures
Fails if the given string is not a valid Name
.
Examples
let name = Name::from_str("hello")?; assert_eq!(name, "hello"); assert!(Name::from_str("").is_err(), "Empty string is not a Name"); assert!(Name::from_str("foo bar").is_err(), "Whitespace is not allowed");
#[must_use]pub unsafe fn new_unchecked(s: &str) -> &Self
[src]
Creates a new &Name
without validation.
Safety
The given string should be a valid Name
.
Examples
let name = unsafe { Name::new_unchecked("hello") }; assert_eq!(name, "hello");
#[must_use]pub fn as_str(&self) -> &str
[src]
Returns the string as &str
.
Examples
let name = Name::from_str("hello")?; assert_eq!(name, "hello"); let s: &str = name.as_str(); assert_eq!(s, "hello");
pub fn parse_next(s: &str) -> Result<(&Self, &str), NameError>
[src]
Parses the leading Name
and returns the value and the rest input.
Exmaples
let input = "hello, world"; let expected = Name::from_str("hello").expect("valid Name"); assert_eq!( Name::parse_next(input), Ok((expected, ", world")) );
let input = "012"; assert!(Name::parse_next(input).is_err());
pub fn into_boxed_str(self: Box<Self>) -> Box<str>
[src]
Converts a Box<Name>
into a Box<str>
without copying or allocating.
Examples
let name = Name::from_str("name")?; let boxed_name: Box<Name> = 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<Name> for Name
[src]
impl AsRef<Name> for Ncname
[src]
impl AsRef<Name> for Qname
[src]
impl AsRef<Nmtoken> for Name
[src]
impl AsRef<str> for Name
[src]
impl<'_> Debug for &'_ Name
[src]
impl<'_> Display for &'_ Name
[src]
impl Eq for Name
[src]
impl<'_> From<&'_ Name> for Box<Name>
[src]
impl<'_> From<&'_ Name> for Rc<Name>
[src]
impl<'_> From<&'_ Name> for Arc<Name>
[src]
impl<'a> From<&'a Name> for &'a Nmtoken
[src]
impl<'a> From<&'a Ncname> for &'a Name
[src]
impl<'a> From<&'a Qname> for &'a Name
[src]
impl Hash for Name
[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 Name
[src]
pub fn cmp(&self, other: &Name) -> 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<&'_ Name> for str
[src]
impl<'_> PartialEq<&'_ String> for Name
[src]
pub fn eq(&self, o: &&String) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<&'_ str> for Name
[src]
impl PartialEq<Box<str, Global>> for Name
[src]
pub fn eq(&self, o: &Box<str>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<'_> PartialEq<Cow<'_, str>> for Name
[src]
pub fn eq(&self, o: &Cow<'_, str>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<Name> for Name
[src]
impl PartialEq<Name> for str
[src]
impl<'_> PartialEq<Name> for &'_ str
[src]
impl PartialEq<Name> for String
[src]
impl<'_> PartialEq<Name> for &'_ String
[src]
impl PartialEq<Name> for Box<str>
[src]
impl<'_> PartialEq<Name> for Cow<'_, str>
[src]
impl PartialEq<String> for Name
[src]
impl PartialEq<str> for Name
[src]
impl<'_> PartialEq<str> for &'_ Name
[src]
impl<'_> PartialOrd<&'_ Name> for str
[src]
pub fn partial_cmp(&self, o: &&Name) -> 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<&'_ String> for Name
[src]
pub fn partial_cmp(&self, o: &&String) -> 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<&'_ str> for Name
[src]
pub fn partial_cmp(&self, o: &&str) -> 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<Box<str, Global>> for Name
[src]
pub fn partial_cmp(&self, o: &Box<str>) -> 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<Cow<'_, str>> for Name
[src]
pub fn partial_cmp(&self, o: &Cow<'_, str>) -> 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<Name> for Name
[src]
pub fn partial_cmp(&self, other: &Name) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Name) -> bool
[src]
pub fn le(&self, other: &Name) -> bool
[src]
pub fn gt(&self, other: &Name) -> bool
[src]
pub fn ge(&self, other: &Name) -> bool
[src]
impl PartialOrd<Name> for str
[src]
pub fn partial_cmp(&self, o: &Name) -> 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<Name> for &'_ str
[src]
pub fn partial_cmp(&self, o: &Name) -> 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<Name> for String
[src]
pub fn partial_cmp(&self, o: &Name) -> 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<Name> for &'_ String
[src]
pub fn partial_cmp(&self, o: &Name) -> 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<Name> for Box<str>
[src]
pub fn partial_cmp(&self, o: &Name) -> 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<Name> for Cow<'_, str>
[src]
pub fn partial_cmp(&self, o: &Name) -> 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<String> for Name
[src]
pub fn partial_cmp(&self, o: &String) -> 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<str> for Name
[src]
pub fn partial_cmp(&self, o: &str) -> 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<str> for &'_ Name
[src]
pub fn partial_cmp(&self, o: &str) -> 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 StructuralEq for Name
[src]
impl StructuralPartialEq for Name
[src]
impl ToOwned for Name
[src]
type Owned = Box<Name>
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> Self::Owned
[src]
pub fn clone_into(&self, target: &mut Self::Owned)
[src]
impl<'a> TryFrom<&'a Name> for &'a Ncname
[src]
type Error = NameError
The type returned in the event of a conversion error.
pub fn try_from(s: &'a Name) -> Result<Self, Self::Error>
[src]
impl<'a> TryFrom<&'a Nmtoken> for &'a Name
[src]
type Error = NameError
The type returned in the event of a conversion error.