Crates.io | dolarhoy-core |
lib.rs | dolarhoy-core |
version | 0.3.0 |
source | src |
created_at | 2023-08-03 20:28:38.556958 |
updated_at | 2024-06-19 21:05:21.304271 |
description | A crate for fetching currency values from dolarhoy.com |
homepage | |
repository | https://github.com/emaphp/dolarhoy-core/ |
max_upload_size | |
id | 934389 |
size | 30,822 |
A crate for fetching currency values from dolarhoy.com.
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(())
}
Released under the MIT License.
DolarHoy.com ® is a registered trademark. I don't hold any type of relation to the company or its staff.