Struct aho_corasick::MatchError
source · pub struct MatchError(/* private fields */);
Expand description
An error that occurred during an Aho-Corasick search.
An error that occurs during a search is limited to some kind of misconfiguration that resulted in an illegal call. Stated differently, whether an error occurs is not dependent on the specific bytes in the haystack.
Examples of misconfiguration:
- Executing a stream or overlapping search on a searcher that was built was
something other than
MatchKind::Standard
semantics. - Requested an anchored or an unanchored search on a searcher that doesn’t support unanchored or anchored searches, respectively.
When the std
feature is enabled, this implements the std::error::Error
trait.
Implementations§
source§impl MatchError
impl MatchError
sourcepub fn new(kind: MatchErrorKind) -> MatchError
pub fn new(kind: MatchErrorKind) -> MatchError
Create a new error value with the given kind.
This is a more verbose version of the kind-specific constructors, e.g.,
MatchError::unsupported_stream
.
sourcepub fn kind(&self) -> &MatchErrorKind
pub fn kind(&self) -> &MatchErrorKind
Returns a reference to the underlying error kind.
sourcepub fn invalid_input_anchored() -> MatchError
pub fn invalid_input_anchored() -> MatchError
Create a new “invalid anchored search” error. This occurs when the caller requests an anchored search but where anchored searches aren’t supported.
This is the same as calling MatchError::new
with a
MatchErrorKind::InvalidInputAnchored
kind.
sourcepub fn invalid_input_unanchored() -> MatchError
pub fn invalid_input_unanchored() -> MatchError
Create a new “invalid unanchored search” error. This occurs when the caller requests an unanchored search but where unanchored searches aren’t supported.
This is the same as calling MatchError::new
with a
MatchErrorKind::InvalidInputUnanchored
kind.
sourcepub fn unsupported_stream(got: MatchKind) -> MatchError
pub fn unsupported_stream(got: MatchKind) -> MatchError
Create a new “unsupported stream search” error. This occurs when the
caller requests a stream search while using an Aho-Corasick automaton
with a match kind other than MatchKind::Standard
.
The match kind given should be the match kind of the automaton. It
should never be MatchKind::Standard
.
sourcepub fn unsupported_overlapping(got: MatchKind) -> MatchError
pub fn unsupported_overlapping(got: MatchKind) -> MatchError
Create a new “unsupported overlapping search” error. This occurs when
the caller requests an overlapping search while using an Aho-Corasick
automaton with a match kind other than MatchKind::Standard
.
The match kind given should be the match kind of the automaton. It
should never be MatchKind::Standard
.
sourcepub fn unsupported_empty() -> MatchError
pub fn unsupported_empty() -> MatchError
Create a new “unsupported empty pattern” error. This occurs when the caller requests a search for which matching an automaton that contains an empty pattern string is not supported.
Trait Implementations§
source§impl Clone for MatchError
impl Clone for MatchError
source§fn clone(&self) -> MatchError
fn clone(&self) -> MatchError
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MatchError
impl Debug for MatchError
source§impl Display for MatchError
impl Display for MatchError
source§impl Error for MatchError
impl Error for MatchError
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
source§impl PartialEq for MatchError
impl PartialEq for MatchError
source§fn eq(&self, other: &MatchError) -> bool
fn eq(&self, other: &MatchError) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for MatchError
impl StructuralPartialEq for MatchError
Auto Trait Implementations§
impl Freeze for MatchError
impl RefUnwindSafe for MatchError
impl Send for MatchError
impl Sync for MatchError
impl Unpin for MatchError
impl UnwindSafe for MatchError
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)