dolarhoy-core

Crates.iodolarhoy-core
lib.rsdolarhoy-core
version0.3.0
sourcesrc
created_at2023-08-03 20:28:38.556958
updated_at2024-06-19 21:05:21.304271
descriptionA crate for fetching currency values from dolarhoy.com
homepage
repositoryhttps://github.com/emaphp/dolarhoy-core/
max_upload_size
id934389
size30,822
Emmanuel Antico (emaphp)

documentation

README

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.

Commit count: 13

cargo fmt