Rust library that returns addresses from the Brazilian Postal Code (CEP)
using the following APIs: Correios, ViaCEP, Cepla
Readme in Português
Rust project inspired by https://github.com/IgorHalfeld/lagoinha used to retrieve Addresses from the Brazilian Postal Code (CEP)
✔️ - Contributions and reviews are appreciated !
Lagoinha is a package that uses public APIs to fetch addresses using the Brazilian Postal Code (CEP). This package cuncurrenlty calls all the supported APIs and returns the first result.
It means "little pond". It is a Brazillian meme ! Check the videovídeo!
toml
lagoinha-rs = "0.2"
```rust use lagoinha; use async_std;
fn main() { let addr = asyncstd::task::blockon(lagoinha::getaddress("CEPGOES_HERE")); println!("{:#?}", addr); } ``` The fisrt method should be similar for any async runtime.
Or in a Async function (example using Tokio):
```rust use lagoinha; use tokio;
async fn main() { let addr = lagoinha::getaddress("CEPGOES_HERE", None).await; println!("{:#?}", addr); } ```
Check the examples folder ! To run them, use the commands below.
```bash
cargo run --example getaddress 20940040 cargo run --example getaddresstokio 20940040 cargo run --example standaloneservices 20940040
```
This library uses isahc as its http client because: 1) It works in any async backend, and 2) It offers a configuration option for Title-Case headers (necessary for CepLá)