#unit #math #conversion

rink-core

Unit conversion library behind rink

3 unstable releases

0.6.0 Apr 6, 2021
0.5.1 Aug 30, 2020
0.5.0 Jul 18, 2020

#314 in Math

46 downloads per month
Used in rink

MPL-2.0 license

300KB
8K SLoC

Rink Core

Rink Core is the library that implements most of the special language and calculations in Rink. It's mainly intended to be used in projects that are exposing an end user interface to Rink, e.g. a discord bot or a mobile app.


lib.rs:

The primary interface of this library is meant to expose a very simple command-reply model for frontends, and to allow gradual addition of more advanced functionality. For now, only basic functionality exists.

Using Rink as a library for uses other than simple unit conversion tools is not currently well supported, and if you wish to do so, please make issues for any problems you have.

There are currently a number of hardcoded println!s and unwrap()s because most of this code was written in a day without much thought towards making it into a library.

To use the library, check how the CLI tool does it. To get additional features like currency and BTC you'll need to fetch those files yourself and add them into the Context.

Example

use rink_core::*;

let mut ctx = simple_context().unwrap();
println!("{}", one_line(&mut ctx, "kWh / year -> W").unwrap());

Dependencies

~2–2.9MB
~55K SLoC