Struct hyperscan::expression::info::ExprInfo
source · pub struct ExprInfo {
pub min_width: ExprWidth,
pub max_width: Option<ExprWidth>,
pub unordered_matches: UnorderedMatchBehavior,
pub matches_at_eod: MatchAtEndBehavior,
}compiler only.Expand description
Data produced by hyperscan to analyze a particular expression.
This struct is produced by Expression::info():
use hyperscan::{expression::{*, info::*}, flags::Flags};
let expr: Expression = "(he)llo$".parse()?;
let info = expr.info(Flags::default())?;
assert_eq!(info, ExprInfo {
min_width: ExprWidth(5),
max_width: Some(ExprWidth(5)),
unordered_matches: UnorderedMatchBehavior::AllowsUnordered,
matches_at_eod: MatchAtEndBehavior::WillOnlyMatchAtEOD,
});as well as Expression::ext_info():
use hyperscan::{expression::{*, info::*}, flags::Flags};
let expr: Expression = ".*lo($)?".parse()?;
let ext = ExprExt::from_min_length(4);
let info = expr.ext_info(Flags::default(), &ext)?;
assert_eq!(info, ExprInfo {
min_width: ExprWidth(4),
max_width: None,
unordered_matches: UnorderedMatchBehavior::AllowsUnordered,
matches_at_eod: MatchAtEndBehavior::MayMatchAtEOD,
});Fields§
§min_width: ExprWidthThe minimum length in bytes of a match for the pattern. If the pattern has an unbounded minimum length, this will be 0.
Note: in some cases when using advanced features to suppress matches
(such as extended parameters or Flags::SINGLEMATCH) this
may represent a conservative lower bound for the true minimum length of
a match.
max_width: Option<ExprWidth>The maximum length in bytes of a match for the pattern. If the pattern
has an unbounded maximum length, this will be None.
Note: in some cases when using advanced features to suppress matches
(such as extended parameters or Flags::SINGLEMATCH) this
may represent a conservative upper bound for the true maximum length of
a match.
unordered_matches: UnorderedMatchBehaviorWhether this expression can produce matches that are not returned in order, such as those produced by assertions.
matches_at_eod: MatchAtEndBehaviorWhether this expression can produce matches at end of data (EOD).
In streaming mode, EOD matches are raised during
Scratch::flush_eod_sync() or
Scratch::flush_eod(), since it
is only when flush_eod() is called that the EOD location is
known.
Note: trailing \b word boundary assertions may also result in EOD
matches as end-of-data can act as a word boundary.
Trait Implementations§
source§impl Ord for ExprInfo
impl Ord for ExprInfo
source§impl PartialEq for ExprInfo
impl PartialEq for ExprInfo
source§impl PartialOrd for ExprInfo
impl PartialOrd for ExprInfo
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Copy for ExprInfo
impl Eq for ExprInfo
impl StructuralEq for ExprInfo
impl StructuralPartialEq for ExprInfo
Auto Trait Implementations§
impl RefUnwindSafe for ExprInfo
impl Send for ExprInfo
impl Sync for ExprInfo
impl Unpin for ExprInfo
impl UnwindSafe for ExprInfo
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.