pub struct FilterSet { /* private fields */ }
Expand description
Manages a set of rules to be added to an crate::Engine
.
To be able to efficiently handle special options like $badfilter
, and to allow optimizations,
all rules must be available when the Engine
is first created. FilterSet
allows assembling a
compound list from multiple different sources before compiling the rules into an Engine
.
Implementations§
source§impl FilterSet
impl FilterSet
sourcepub fn new(debug: bool) -> Self
pub fn new(debug: bool) -> Self
Creates a new FilterSet
. debug
specifies whether or not to save information about the
original raw filter rules alongside the more compact internal representation. If enabled,
this information will be passed to the corresponding Engine
.
sourcepub fn add_filter_list(
&mut self,
filter_list: &str,
opts: ParseOptions
) -> FilterListMetadata
pub fn add_filter_list( &mut self, filter_list: &str, opts: ParseOptions ) -> FilterListMetadata
Adds the contents of an entire filter list to this FilterSet
. Filters that cannot be
parsed successfully are ignored. Returns any discovered metadata about the list of rules
added.
sourcepub fn add_filters(
&mut self,
filters: impl IntoIterator<Item = impl AsRef<str>>,
opts: ParseOptions
) -> FilterListMetadata
pub fn add_filters( &mut self, filters: impl IntoIterator<Item = impl AsRef<str>>, opts: ParseOptions ) -> FilterListMetadata
Adds a collection of filter rules to this FilterSet
. Filters that cannot be parsed
successfully are ignored. Returns any discovered metadata about the list of rules added.
sourcepub fn add_filter(
&mut self,
filter: &str,
opts: ParseOptions
) -> Result<(), FilterParseError>
pub fn add_filter( &mut self, filter: &str, opts: ParseOptions ) -> Result<(), FilterParseError>
Adds the string representation of a single filter rule to this FilterSet
.