Crates.io | viacep_rs |
lib.rs | viacep_rs |
version | 0.2.0 |
source | src |
created_at | 2020-01-27 18:19:41.799683 |
updated_at | 2020-01-27 20:22:16.544615 |
description | The Via CEP client wrapper written in Rust. |
homepage | https://github.com/guibranco/viacep-rs |
repository | https://github.com/guibranco/viacep-rs.git |
max_upload_size | |
id | 202467 |
size | 81,565 |
The ViaCEP client wrapper written in Rust
Service | Status |
---|---|
AppveyorCI | |
crates.io |
Pure Rust bindings to the Holiday API.
viacep-rs is intended to work on all tier 1 supported Rust systems:
Due to the use of certain features holiday-api-rust requires rustc
version 1.18 or
higher.
Add the following to your Cargo.toml
[dependencies]
viacep_rs = "0.2.0"
serde_json = "1.0"
Then in your lib.rs
or main.rs
file add:
extern crate viacep_rs;
let client = ViaCepClient::new();
// Single Zip Code data
match client.get_zipcode("03177010") {
Err(e) => eprintln!("{:?}", e),
Ok(data) => {
let cep = data.unwrap();
println!("IBGE: {} | Address: {} | Neighborhood: {} | City: {} | UF: {}", cep.ibge, cep.Address, cep.Neighborhood, cep.City, cep.state_initials);
}
}
//Find by address data
match client.search("SP", "Sâo Paulo", "Paulista") {
Err(e) => eprintln!("{:?}", e),
Ok(data) => {
let addresses = data.unwrap();
for address in addresses {
println!("IBGE: {} | Address: {} | City: {} | Zip: {}", address.ibge, address.address, address.city, address.zip);
}
}
}
Licensed under