Skip to main content

Crate zipcodes

Crate zipcodes 

Source
Expand description

Query U.S. zipcodes without SQLite.

The full zipcode dataset is embedded into the binary at compile time via include_bytes! and lazily decompressed/parsed on first access, making this crate suitable for constrained environments (AWS Lambda, containers) with no runtime file I/O.

Structs§

Zipcode
A record in the zipcode database.

Enums§

Error
Describes different types of errors with supplied zipcodes during parsing.

Functions§

contains
Return the zipcodes whose zip_code contains the supplied fragment anywhere.
database
Borrow the full embedded zipcode database without copying it.
filter_by
Using a supplied list of filter-functions, return a filtered list of zipcodes.
filter_by_coordinates
Return the zipcodes within radius_in_miles of the supplied coordinates.
filter_by_fields
Return the zipcodes whose named fields equal the supplied JSON values.
haversine
Calculate the great circle distance in miles between two points on the earth, specified in decimal degrees.
is_real
Returns true if the supplied zipcode exists in the database.
list_all
Retrieve a list of all zipcodes in the database.
matching
Determine whether a supplied zipcode matches any existing zipcode. The supplied zipcode must be of the format: “#####”, “#####-####”, or “##### ####”.
similar_to
Return the zipcodes whose zip_code starts with the supplied prefix.

Type Aliases§

Result
A result type where the error is an Error.