Struct aho_corasick::MatchError
source · [−]pub struct MatchError(_);
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
sourceimpl 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
sourceimpl Clone for MatchError
impl Clone for MatchError
sourcefn clone(&self) -> MatchError
fn clone(&self) -> MatchError
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more