[][src]Struct xml_string::names::NameError

pub struct NameError { /* fields omitted */ }

Name error.

Implementations

impl NameError[src]

#[must_use]pub fn valid_up_to(&self) -> usize[src]

Returns the index in the given string up to which valid name was verified.

Note that &source_str[..err.valid_up_to()] might be invalid when valid_up_to is zero. In other words, it depends on target type whether the empty string is valid or not. This error type does not assume anything about it.

Examples

use xml_string::names::Ncname;

let err_nonempty = Ncname::from_str("foo:bar").expect_err("NCName cannot have a colon");
assert_eq!(err_nonempty.valid_up_to(), 3);
assert!(Ncname::from_str("foo").is_ok());

let err_empty = Ncname::from_str("").expect_err("NCName cannot be empty");
assert_eq!(err_empty.valid_up_to(), 0);
assert!(
    Ncname::from_str("").is_err(),
    "Note that `&s[..err.valid_up_to()]` is not always valid for the empty source string"
);

Trait Implementations

impl Clone for NameError[src]

impl Copy for NameError[src]

impl Debug for NameError[src]

impl Display for NameError[src]

impl Eq for NameError[src]

impl Error for NameError[src]

impl PartialEq<NameError> for NameError[src]

impl StructuralEq for NameError[src]

impl StructuralPartialEq for NameError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.