| Crates.io | unitx-core |
| lib.rs | unitx-core |
| version | 0.1.0 |
| created_at | 2025-10-27 08:59:28.446518+00 |
| updated_at | 2025-10-27 08:59:28.446518+00 |
| description | Fast unit conversion primitives with live currency rates. |
| homepage | https://github.com/mrteesoft/unitx |
| repository | https://github.com/mrteesoft/unitx |
| max_upload_size | |
| id | 1902483 |
| size | 73,029 |
Core library for the unitx project. Provides temperature, distance, and live currency conversions with validation utilities.
cargo add unitx-core
use rust_decimal::Decimal;
use unitx_core::currency::{convert, CurrencyUnit};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let amount = Decimal::new(10000, 2); // 100.00
let eur = convert(amount, CurrencyUnit::USD, CurrencyUnit::EUR)?;
println!("USD {} -> EUR {}", amount, eur);
Ok(())
}
Currency rates are sourced from the European Central Bank daily feed (no API keys required).
Live FX roundtrip tests are marked #[ignore]; run cargo test -- --ignored with network access to exercise them.