pub struct PolygonHandler;Expand description
Polygon coordinate validator
Validates polygon coordinate strings in the format “(lat1,lon1,lat2,lon2,lat1,lon1)” and ensures proper polygon geometry (closed, minimum vertices, valid coordinates).
Implementations§
Source§impl PolygonHandler
impl PolygonHandler
pub fn validate_and_canonicalize( value: &str, field_name: &str, ) -> Result<String>
Sourcepub fn parse_polygon_coordinates(coord_string: &str) -> Result<Vec<(f64, f64)>>
pub fn parse_polygon_coordinates(coord_string: &str) -> Result<Vec<(f64, f64)>>
Parse a polygon coordinate string into a vector of (lat, lon) tuples.
Accepted forms (whitespace tolerated everywhere):
"(lat1,lon1,...,lat1,lon1)"— parenthesised, balanced"lat1,lon1,...,lat1,lon1"— no parentheses
Rejected forms (each with a specific error message):
- Opening
(without a matching closing)(or vice versa) - Embedded
(or)anywhere except as the single outer pair - Empty string or
() - Odd number of comma-separated values
- Any value that does not parse as
f64
This function ALWAYS returns (lat, lon) pairs. DO NOT swap here; only
swap to (lon, lat) when passing to the geo crate.
Sourcepub fn calculate_bounding_box(coordinates: &[(f64, f64)]) -> String
pub fn calculate_bounding_box(coordinates: &[(f64, f64)]) -> String
Calculates bounding box for spatial filtering optimization This will be used later when we handle the payload and headers
pub fn parse_bbox_coordinates(s: &str) -> Result<(f64, f64, f64, f64)>
Auto Trait Implementations§
impl Freeze for PolygonHandler
impl RefUnwindSafe for PolygonHandler
impl Send for PolygonHandler
impl Sync for PolygonHandler
impl Unpin for PolygonHandler
impl UnsafeUnpin for PolygonHandler
impl UnwindSafe for PolygonHandler
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