Crates.io | lagoinha |
lib.rs | lagoinha |
version | 0.2.0 |
source | src |
created_at | 2020-07-27 05:13:05.361169 |
updated_at | 2021-01-02 07:12:32.356721 |
description | 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. |
homepage | https://github.com/auyer/lagoinha-rs |
repository | https://github.com/auyer/lagoinha-rs |
max_upload_size | |
id | 269978 |
size | 86,033 |
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!
lagoinha-rs = "0.2"
use lagoinha;
use async_std;
fn main() {
let addr = async_std::task::block_on(lagoinha::get_address("CEP_GOES_HERE"));
println!("{:#?}", addr);
}
The fisrt method should be similar for any async runtime.
Or in a Async function (example using Tokio):
use lagoinha;
use tokio;
#[tokio::main]
async fn main() {
let addr = lagoinha::get_address("CEP_GOES_HERE", None).await;
println!("{:#?}", addr);
}
Check the examples folder ! To run them, use the commands below.
# these examples can be run with a specific CEP (or leave blank for default value)
cargo run --example get_address 20940040
cargo run --example get_address_tokio 20940040
cargo run --example standalone_services 20940040
This library uses isahc as its http client because:
It works in any async backend, and
It offers a configuration option for Title-Case headers (necessary for CepLá)