[][src]Crate lagoinha

Lagoinha is a library that retrieve Addresses from the Brazilian Postal Code (CEP) using multiple APIs asynchronously, and returns the result from the first one to respond. It uses async/.await and the Futures library for its asyncronous features, and can be used with most runtimes.

Services

Currenlty the services used are : correios, viacep and cepla It is expected to support adding a custom service to the pool in the future, and the ability to disable the default ones.

While the default http library is Hyper, the CepLá service has an issue with its header implementation, and so the curl library was used. More information in the docs for this service.

Example

extern crate lagoinha;
extern crate tokio;

#[tokio::main]
async fn main() {    
   let addr = lagoinha::get_address("70150903", None).await;
   println!("{:#?}", addr);
}

Modules

error
services

Functions

get_address

get_address runs concurent calls to available services requesting the address related to the provided cep, and with a error_timeout in seconds in case some services fail.