Skip to main content

GridSystem

Trait GridSystem 

Source
pub trait GridSystem: Default {
    type Identifier: GridIdentifier;
    type Poly: GridPolygon<Identifier = Self::Identifier>;

    // Required methods
    fn name(&self) -> &str;
    fn defining_agency(&self) -> Agency;
    fn lookup_id(
        &self,
        id: &Self::Identifier,
    ) -> Result<Option<Self::Poly>, GeoError>;

    // Provided method
    fn lookup_point(
        &self,
        point: &Coordinate,
    ) -> Result<Option<Self::Poly>, GeoError> { ... }
}
Expand description

A grid system that can convert identifiers and coordinates to cell polygons.

Required Associated Types§

Required Methods§

Source

fn name(&self) -> &str

The human-readable name of this grid system (e.g. "Maidenhead Locator System").

Source

fn defining_agency(&self) -> Agency

The agency that defines or maintains this grid system.

Source

fn lookup_id( &self, id: &Self::Identifier, ) -> Result<Option<Self::Poly>, GeoError>

Look up the polygon for a given cell identifier, returning None if not found.

Provided Methods§

Source

fn lookup_point( &self, point: &Coordinate, ) -> Result<Option<Self::Poly>, GeoError>

Look up the polygon for the cell that contains point.

The default implementation converts the coordinate to an identifier and delegates to lookup_id.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§