Struct icu::experimental::unicodeset_parse::ParseError
source · pub struct ParseError { /* private fields */ }
Expand description
The error type returned by the parse
functions in this crate.
See ParseError::fmt_with_source
for pretty-printing and ParseErrorKind
of the
different types of errors represented by this struct.
Implementations§
source§impl ParseError
impl ParseError
sourcepub fn fmt_with_source(&self, source: &str) -> impl Display
pub fn fmt_with_source(&self, source: &str) -> impl Display
Pretty-prints this error and if applicable, shows where the error occurred in the source.
Must be called with the same source that was used to parse the set.
§Examples
use icu::experimental::unicodeset_parse::*;
let source = "[[abc]-x]";
let set = parse(source);
assert!(set.is_err());
let err = set.unwrap_err();
assert_eq!(
err.fmt_with_source(source).to_string(),
"[[abc]-x← error: unexpected character 'x'"
);
use icu::experimental::unicodeset_parse::*;
let source = r"[\N{LATIN CAPITAL LETTER A}]";
let set = parse(source);
assert!(set.is_err());
let err = set.unwrap_err();
assert_eq!(
err.fmt_with_source(source).to_string(),
r"[\N← error: unimplemented"
);
sourcepub fn kind(&self) -> ParseErrorKind
pub fn kind(&self) -> ParseErrorKind
Returns the ParseErrorKind
of this error.
Trait Implementations§
source§impl Clone for ParseError
impl Clone for ParseError
source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ParseError
impl Debug for ParseError
source§impl From<ParseErrorKind> for ParseError
impl From<ParseErrorKind> for ParseError
source§fn from(kind: ParseErrorKind) -> ParseError
fn from(kind: ParseErrorKind) -> ParseError
Converts to this type from the input type.
source§impl PartialEq for ParseError
impl PartialEq for ParseError
impl Copy for ParseError
impl Eq for ParseError
impl StructuralPartialEq for ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more