yash-arith

Crates.ioyash-arith
lib.rsyash-arith
version0.2.1
sourcesrc
created_at2022-10-01 02:18:04.531319
updated_at2023-11-11 15:14:28.60691
descriptionPOSIX shell arithmetic expansion
homepage
repositoryhttps://github.com/magicant/yash-rs
max_upload_size
id677592
size200,665
WATANABE Yuki (magicant)

documentation

README

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.

Commit count: 2944

cargo fmt