Struct tz_search::TzSearch [] [src]

pub struct TzSearch { /* fields omitted */ }

All the information required for efficient time-zone lookups.

Unless you need absolutely strict control over memory use, you probably want to call the top-level lookup, rather than going via this.

Methods

impl TzSearch
[src]

Create a new TzSearch.

This is very expensive: the initialisation routine takes a long time, and the resulting structure uses a lot of memory. Hence, this should be called as rarely as possible.

The free-standing lookup function internally manages creating exactly one of these, and should be preferred.

Attempt to compute the timezone that the point lat, long lies in.

The latitude lat should lie in the range [-90, 90] with negative representing south, and the longitude should lie in the range [-180, 180] with negative representing west. This will fail (return None) if the point lies in the ocean.

See also: the lookup function at the top-level.

Panics

lookup will panic if either of the two ranges above are violated.

Examples

let s = tz_search::TzSearch::new();
let (lat, long) = (-33.8885, 151.1908);
assert_eq!(s.lookup(lat, long).unwrap(),
           "Australia/Sydney");

Trait Implementations

impl Debug for TzSearch
[src]

Formats the value using the given formatter.