Struct tzf_rs::FuzzyFinder
source · pub struct FuzzyFinder { /* private fields */ }
Expand description
FuzzyFinder store all preindex’s tiles data in a HashMap, It iterate all zoom levels for input’s longitude and latitude to build map key to to check if in map.
It’s is very fast and use about 400ns to check if has preindex. It work for most places on earch and here is a quick loop of preindex data:
Implementations§
source§impl FuzzyFinder
impl FuzzyFinder
pub fn from_pb(tzs: PreindexTimezones) -> FuzzyFinder
sourcepub fn new() -> FuzzyFinder
pub fn new() -> FuzzyFinder
use tzf_rs::FuzzyFinder;
let finder = FuzzyFinder::new();
sourcepub fn get_tz_name(&self, lng: f64, lat: f64) -> &str
pub fn get_tz_name(&self, lng: f64, lat: f64) -> &str
Example:
use tzf_rs::FuzzyFinder;
let finder = FuzzyFinder::new();
assert_eq!("Asia/Shanghai", finder.get_tz_name(116.3883, 39.9289));