https://github.com/guibranco/viacep-sdk-rs
🇧🇷 📍 ViaCEP client wrapper for Rust projects
https://github.com/guibranco/viacep-sdk-rs
address api cep code correios fazenda gia hacktoberfest ibge mf postal postalcode viacep webservice ws zip zipcode
Last synced: 3 months ago
JSON representation
🇧🇷 📍 ViaCEP client wrapper for Rust projects
- Host: GitHub
- URL: https://github.com/guibranco/viacep-sdk-rs
- Owner: guibranco
- License: mit
- Created: 2020-01-27T16:42:51.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2026-03-07T01:57:18.000Z (3 months ago)
- Last Synced: 2026-03-07T02:03:59.094Z (3 months ago)
- Topics: address, api, cep, code, correios, fazenda, gia, hacktoberfest, ibge, mf, postal, postalcode, viacep, webservice, ws, zip, zipcode
- Language: Rust
- Homepage: http://guilherme.stracini.com.br/viacep-rs/
- Size: 150 KB
- Stars: 6
- Watchers: 0
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ViaCEP Rust client
🇧🇷📍 [ViaCEP](https://viacep.com.br) client wrapper for Rust projects.


[](https://wakatime.com/badge/github/guibranco/viacep-rs)
| Service | Status |
| ------- | :----: |
| AppVeyor CI | [](https://ci.appveyor.com/project/guibranco/viacep-rs/branch/main) |
| crates.io | [](https://crates.io/crates/viacep-rs) |
Pure Rust bindings to the [ViaCEP API](https://viacep.com.br).
## Dependencies and support
`viacep-rs` is intended to work on all tier 1 supported Rust systems:
- macOS
- Linux
- Windows
## Minimum Compiler Version
`viacep-rs` requires `rustc` version **1.56 or higher** (Rust 2021 edition).
## Getting Started
Add the following to your `Cargo.toml`:
```toml
[dependencies]
viacep_rs = "0.2.0"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
```
Then in your `lib.rs` or `main.rs` file:
```rust
use viacep_rs::ViaCepClient;
let client = ViaCepClient::new();
// Single Zip Code lookup
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
);
}
}
// Search by address
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
);
}
}
}
```
## License
Licensed under the MIT license ([LICENSE](https://github.com/guibranco/viacep-rs/blob/main/LICENSE) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)).