pub struct RegexpError(/* private fields */);
Expand description
Error that indicates a Regexp
was malformed at runtime.
This error is typically generated by Regexp::compile
.
This error corresponds to the Ruby RegexpError
Exception class.
§Examples
let err = RegexpError::new();
assert_eq!(err.message(), "RegexpError");
let err = RegexpError::with_message(r"invalid multibyte character: /\xFF\xFE/");
assert_eq!(err.message(), r"invalid multibyte character: /\xFF\xFE/");
Implementations§
Source§impl RegexpError
impl RegexpError
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Construct a new, default regexp error.
§Examples
const ERR: RegexpError = RegexpError::new();
assert_eq!(ERR.message(), "RegexpError");
Sourcepub const fn with_message(message: &'static str) -> Self
pub const fn with_message(message: &'static str) -> Self
Construct a new regexp error with a message.
§Examples
const ERR: RegexpError = RegexpError::with_message(r"invalid multibyte character: /\xFF\xFE/");
assert_eq!(ERR.message(), r"invalid multibyte character: /\xFF\xFE/");
Sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
Retrieve the exception message associated with this regexp error.
§Examples
let err = RegexpError::new();
assert_eq!(err.message(), "RegexpError");
let err = RegexpError::with_message(r"invalid multibyte character: /\xFF\xFE/");
assert_eq!(err.message(), r"invalid multibyte character: /\xFF\xFE/");
Trait Implementations§
Source§impl Clone for RegexpError
impl Clone for RegexpError
Source§fn clone(&self) -> RegexpError
fn clone(&self) -> RegexpError
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 RegexpError
impl Debug for RegexpError
Source§impl Display for RegexpError
impl Display for RegexpError
Source§impl Error for RegexpError
impl Error for RegexpError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<&'static str> for RegexpError
impl From<&'static str> for RegexpError
Source§impl From<RegexpError> for Error
impl From<RegexpError> for Error
Source§fn from(err: RegexpError) -> Self
fn from(err: RegexpError) -> Self
Converts to this type from the input type.
Source§impl From<String> for RegexpError
impl From<String> for RegexpError
Source§impl Hash for RegexpError
impl Hash for RegexpError
Source§impl Ord for RegexpError
impl Ord for RegexpError
Source§fn cmp(&self, other: &RegexpError) -> Ordering
fn cmp(&self, other: &RegexpError) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for RegexpError
impl PartialEq for RegexpError
Source§impl PartialOrd for RegexpError
impl PartialOrd for RegexpError
impl Eq for RegexpError
impl StructuralPartialEq for RegexpError
Auto Trait Implementations§
impl Freeze for RegexpError
impl RefUnwindSafe for RegexpError
impl Send for RegexpError
impl Sync for RegexpError
impl Unpin for RegexpError
impl UnwindSafe for RegexpError
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