pub struct FieldFilter {
pub field: String,
pub op: FieldFilterOp,
pub value: FilterValue,
}Expand description
Structured filter that tests a single named attribute of a
ShapefileFeature against a FilterValue using a FieldFilterOp.
§Example
use oxigdal_shapefile::filter::{FieldFilter, FieldFilterOp, FilterValue};
// Match features where "NAME" == "Paris"
let filter = FieldFilter {
field: "NAME".to_string(),
op: FieldFilterOp::Eq,
value: FilterValue::String("Paris".to_string()),
};Fields§
§field: StringThe attribute field name to test.
op: FieldFilterOpThe comparison operator.
value: FilterValueThe right-hand side value.
Implementations§
Source§impl FieldFilter
impl FieldFilter
Sourcepub fn matches(&self, feature: &ShapefileFeature) -> bool
pub fn matches(&self, feature: &ShapefileFeature) -> bool
Returns true if feature satisfies this filter.
Rules:
- If the field is absent from the feature’s attributes, returns
false. Eq/Ne: value-level equality for all types. Float equality is strict (==onf64); callers should avoid usingEq/Newith floating-point values.Gt/Lt/Gte/Lte: numeric comparison; both the attribute and the filter value are cast tof64. Non-numeric types on either side returnfalse.Contains/StartsWith: substring / prefix match on string types only; any other type returnsfalse.
Trait Implementations§
Source§impl Clone for FieldFilter
impl Clone for FieldFilter
Source§fn clone(&self) -> FieldFilter
fn clone(&self) -> FieldFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FieldFilter
impl RefUnwindSafe for FieldFilter
impl Send for FieldFilter
impl Sync for FieldFilter
impl Unpin for FieldFilter
impl UnsafeUnpin for FieldFilter
impl UnwindSafe for FieldFilter
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
Mutably borrows from an owned value. Read more