#convert #language #units #everything #cool #magic #measurement

convers

Cool convert library that converts almost everything(not yet).Units,Languages,Calculations,etc

12 releases

0.2.1 Nov 8, 2024
0.2.0 Nov 8, 2024
0.1.9 Nov 6, 2024

#99 in Value formatting

34 downloads per month

MIT license

28KB
575 lines

convers

convers - is a cool library for converting data from one format to another. The idea is to convert everything from one query, like from one language, unit, etc., to another. There are functions that allow you to do something like that.

Example of usage magic_convert function:

use convers::convert::magic_convert;
#[tokio::main]
async fn main() {
    let query = "1m to cm".to_string();
    let result = magic_convert(&query).await.unwrap(); // Is String - "100 Centimeters"
    let translate_result = magic_convert(&String::from("en:de how are u?")).await.unwrap(); // Is String - "wie geht es dir?" or something like that
    let calculated = magic_convert(&String::from("15/3")).await.unwrap(); // Is String - "5" or "5.0"
}

What's new in release ?

  • Translate bug fix ('to' and ':' issue)
  • Convert currencies(available in magic_convert)

Also you can use provided things directly:

  • Translator struct
  • Measurement struct
  • Evaluate fn

Example of usage Measurement:

use convers::utils::units::{Measurement, Unit};
let a = Measurement::new(50.0, Unit::Meter);
let b = Measurement::new(1.0, Unit::Kilometer);
let c = a + b; // anyhow::Result<Measurement>. If unwrap it equals 1.050 Kilometer

Current available conversions:

  • Units: Length, Mass, Amperes, Watts, Size (like kb), Rem/Px/Em,Temperature, Pressure, Speed, Volume, Area
  • Translate
  • Translate
  • Currencies
  • Evaluate (with Units too)

User Interfaces for convers:

  • convers_prompt - An attempt to create something comfy like Raycast. (Soon it will be better)

Soon will be added:

  • Conversion of timezones
  • CLI convers binary package to crates.io and AUR

Dependencies

~9–21MB
~290K SLoC