yash-arith 0.2.1

POSIX shell arithmetic expansion
Documentation

Yash-arith

yash-arith is a Rust library crate for performing the POSIX shell's arithmetic expansion. This crate is part of yash but can be used independently.

yash-arith at crates.io yash-arith at docs.rs Build status

Usage

Add yash-arith as a dependency in your Cargo.toml.

use std::collections::HashMap;
use yash_arith::{eval, Value};
let mut env = HashMap::new();
env.insert("a".to_owned(), "2".to_owned());
let result = eval("1 + a", &mut env);
assert_eq!(result, Ok(Value::Integer(3)));

License

This crate is distributed under GPLv3.