Crate rink [−] [src]
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.
For basic flow of the library, the bins/
directory has a few
examples. The REPL is very simple, and the IRC bot shows how Rink can
work in a multi-user environment without sessions or meaningful
stdin/stdout.
Example
use rink::*; let mut ctx = load().unwrap(); println!("{}", one_line(&mut ctx, "kWh / year -> W").unwrap());
Reexports
pub use number::Number; |
pub use eval::{Context, Value}; |
Modules
ast | |
date | |
eval | |
factorize | |
gnu_units | |
number | |
text_query |
Functions
load |
Creates a context by searching standard directories for definitions.units. |
one_line |
Evaluates a single line within a context. |