Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guibranco/viacep-rs
🇧🇷 :round_pushpin: ViaCEP client wrapper for Rust projects
https://github.com/guibranco/viacep-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
🇧🇷 :round_pushpin: ViaCEP client wrapper for Rust projects
- Host: GitHub
- URL: https://github.com/guibranco/viacep-rs
- Owner: guibranco
- License: mit
- Created: 2020-01-27T16:42:51.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T12:24:52.000Z (10 months ago)
- Last Synced: 2024-04-22T13:43:36.815Z (10 months ago)
- Topics: address, api, cep, code, correios, fazenda, gia, hacktoberfest, ibge, mf, postal, postalcode, viacep, webservice, ws, zip, zipcode
- Language: Rust
- Homepage: https://guibranco.github.io/viacep-rs/
- Size: 144 KB
- Stars: 5
- Watchers: 2
- 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.
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/guibranco/viacep-rs/main)
![Crates.io](https://img.shields.io/crates/d/viacep-rs)
[![wakatime](https://wakatime.com/badge/github/guibranco/viacep-rs.svg)](https://wakatime.com/badge/github/guibranco/viacep-rs)[![Maintainability](https://api.codeclimate.com/v1/badges/edadaf30dee88d89995c/maintainability)](https://codeclimate.com/github/guibranco/viacep-rs/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/edadaf30dee88d89995c/test_coverage)](https://codeclimate.com/github/guibranco/viacep-rs/test_coverage)
[![CodeFactor](https://www.codefactor.io/repository/github/guibranco/viacep-rs/badge)](https://www.codefactor.io/repository/github/guibranco/viacep-rs)| Service | Status |
| ------- | :----: |
| AppVeyor CI | [![Build status](https://ci.appveyor.com/api/projects/status/w1di231c9hr2tyhy/branch/main?svg=true)](https://ci.appveyor.com/project/guibranco/viacep-rs/branch/main) |
| crates.io | [![crates.io](https://img.shields.io/crates/v/viacep-rs.svg)](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:
- MacOSX
- Linux
- Windows## Minimum Compiler Version
Due to the use of certain features `viacep-rs` requires `rustc` version 1.18 or
higher.## Getting Started
Add the following to your `Cargo.toml`
```toml
[dependencies]
viacep_rs = "0.2.0"
serde_json = "1.0"
```Then in your `lib.rs` or `main.rs` file add:
```rust
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);
}
}
}
```## License
Licensed under
- MIT license ([LICENSE](https://github.com/guibranco/viacep-rs/blob/main/LICENSE) or [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT))