#currency #client #tokio #fetching #values #com #dolarhoy

dolarhoy-core

A crate for fetching currency values from dolarhoy.com

4 releases (2 breaking)

0.3.0 Jun 19, 2024
0.2.1 Oct 20, 2023
0.2.0 Aug 28, 2023
0.1.0 Aug 3, 2023

#239 in HTTP client

MIT license

30KB
668 lines

A crate for fetching currency values from dolarhoy.com.

dolarhoy-core on Crates.io Documentation License: MIT

Table of Contents

Basic Usage

use dolarhoy_core::{client, dolar, error};

type Result<T> = std::result::Result<T, error::ClientError>;

#[tokio::main]
async fn main() -> Result<()> {
    let client = client::DolayHoyClient::new();
    let result = client.fetch_cotizacion::<f32>(dolar::Cotizacion::Blue).await?;

    match result.precio_compra_venta() {
        (compra, None) => println!("{}: {}", result.title(), compra),
        (compra, Some(venta)) => println!("{}: {} / {}", result.title(), compra, venta),
    }

    Ok(())
}

License

Released under the MIT License.

Disclaimer

DolarHoy.com ® is a registered trademark. I don't hold any type of relation to the company or its staff.

Dependencies

~15–25MB
~446K SLoC