Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bombsimon/swedish-postal-codes
📬 Validation package in Rust for Swedish postal codes
https://github.com/bombsimon/swedish-postal-codes
Last synced: 16 days ago
JSON representation
📬 Validation package in Rust for Swedish postal codes
- Host: GitHub
- URL: https://github.com/bombsimon/swedish-postal-codes
- Owner: bombsimon
- License: mit
- Created: 2020-08-02T10:46:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-02T20:25:25.000Z (over 4 years ago)
- Last Synced: 2024-11-21T00:11:28.411Z (21 days ago)
- Language: Rust
- Size: 57.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-sweden - Rust
README
# Swedihs Postal Codes
Validate Swedish postal codes in Rust. The project comes bundled with a list of
valid postal codes. None of them will be revoked manually but it's quite
uncommon for those to get removed. It's however more common for new postal codes
to be added. To support this, the library has an optional fallback API that will
check for valid codes if not found in the CSV.**Note** by turning this feature on, every invalid request will perform a new
HTTP request.## Usage
```toml
[dependencies]
swedish-postal-codes = "0.1.0"
``````rust
use swedish_postal_codes::PostalCode;fn main() {
let fallback = true;
let pc = PostalCode::new(fallback);let from_integer = 11220;
println!("{}: {}", from_integer, pc.valid(from_integer));let from_string = "11120";
println!("{}: {}", from_string, pc.valid(from_string));let invalid = 55555i64;
println!("{}: {}", invalid, pc.valid(invalid));
}
```