Crate rink_core

source ·
Expand description

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());

Re-exports§

  • pub use crate::loader::Context;
  • pub use crate::runtime::Value;

Modules§

Statics§

Functions§

  • A version of eval() that converts results and errors into strings.
  • Tries to create a context that has core definitions only (contents of definitions.units), will fail if the bundle-files feature isn’t enabled. Mainly intended for unit testing.