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 vectorscan to analyze a particular expression.
This struct is produced by super::Expression::info()
:
use vectorscan::{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 super::Expression::ext_info()
:
use vectorscan::{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: ExprWidth
The 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: UnorderedMatchBehavior
Whether this expression can produce matches that are not returned in order, such as those produced by assertions.
matches_at_eod: MatchAtEndBehavior
Whether 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_sync()
,
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 PartialOrd for ExprInfo
impl PartialOrd for ExprInfo
impl Copy for ExprInfo
impl Eq for ExprInfo
impl StructuralPartialEq for ExprInfo
Auto Trait Implementations§
impl Freeze for ExprInfo
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.