| Crates.io | yash-arith |
| lib.rs | yash-arith |
| version | 0.2.2 |
| created_at | 2022-10-01 02:18:04.531319+00 |
| updated_at | 2024-12-14 02:51:41.853495+00 |
| description | POSIX shell arithmetic expansion |
| homepage | |
| repository | https://github.com/magicant/yash-rs |
| max_upload_size | |
| id | 677592 |
| size | 201,050 |
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.
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)));
This crate is distributed under GPLv3.