pub struct ContentFilter { /* private fields */ }Expand description
A filter expression (DDS 1.4, Annex B), checked against a type: a
DDSSQL content filter, with its parameters.
Implementations§
Source§impl ContentFilter
impl ContentFilter
Sourcepub fn new(
ty: &DynamicType,
expression: &str,
parameters: &[String],
) -> Result<ContentFilter, Error>
pub fn new( ty: &DynamicType, expression: &str, parameters: &[String], ) -> Result<ContentFilter, Error>
Parses expression and checks its fields against ty, a struct
type, with parameters for its %n. Fails with
Error::BadParameter for an expression that is not a filter
expression, a field the type does not have or that is not of a
primitive, string or enum type, or fewer parameters than the
expression uses.
Sourcepub fn expression(&self) -> &str
pub fn expression(&self) -> &str
The filter expression.
Sourcepub fn parameters(&self) -> &[String]
pub fn parameters(&self) -> &[String]
The expression parameters.
Sourcepub fn parameter_count(&self) -> usize
pub fn parameter_count(&self) -> usize
How many parameters the expression uses: its highest %n, plus 1.
Sourcepub fn get_type(&self) -> &DynamicType
pub fn get_type(&self) -> &DynamicType
The type the filter is for.
Sourcepub fn set_parameters(&mut self, parameters: &[String]) -> Result<(), Error>
pub fn set_parameters(&mut self, parameters: &[String]) -> Result<(), Error>
Changes the expression parameters. Fails with
Error::BadParameter when there are fewer than the expression
uses, or more than 100.
Sourcepub fn evaluate(&self, data: &DynamicData) -> bool
pub fn evaluate(&self, data: &DynamicData) -> bool
Whether data passes the filter. A value of another type than the
filter’s does not.
Trait Implementations§
Source§impl Clone for ContentFilter
impl Clone for ContentFilter
Source§fn clone(&self) -> ContentFilter
fn clone(&self) -> ContentFilter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more