#currency #com #values #fetching #error #client #dolarhoy

dolarhoy-core

A crate for fetching currency values from dolarhoy.com

3 unstable releases

0.2.1 Oct 20, 2023
0.2.0 Aug 28, 2023
0.1.0 Aug 3, 2023

#16 in #fetching

Download history 6/week @ 2024-02-19 12/week @ 2024-02-26 55/week @ 2024-04-01

55 downloads per month

MIT license

29KB
642 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

~14–26MB
~439K SLoC