Function geohash::neighbors

source ·
pub fn neighbors(hash_str: &str) -> Result<Neighbors, GeohashError>
Expand description

Find all neighboring geohashes for the given geohash.

§Examples

let geohash_str = "9q60y60rhs";

let neighbors = geohash::neighbors(geohash_str).expect("Invalid hash string");

assert_eq!(
    neighbors,
    geohash::Neighbors {
        n: "9q60y60rht".to_owned(),
        ne: "9q60y60rhv".to_owned(),
        e: "9q60y60rhu".to_owned(),
        se: "9q60y60rhg".to_owned(),
        s: "9q60y60rhe".to_owned(),
        sw: "9q60y60rh7".to_owned(),
        w: "9q60y60rhk".to_owned(),
        nw: "9q60y60rhm".to_owned(),
    }
);