| Crates.io | virtual_exec |
| lib.rs | virtual_exec |
| version | 0.1.0 |
| created_at | 2025-12-08 00:48:40.894808+00 |
| updated_at | 2025-12-08 00:48:40.894808+00 |
| description | A sandbox execution environment which allowed limited execution of expression safely (WIP) |
| homepage | |
| repository | https://github.com/i-am-unknown-81514525/virtual_exec |
| max_upload_size | |
| id | 1972570 |
| size | 51,798 |
A rust library to perform sandboxed safe expression evaluation, in a similar syntax to rust
use virtual_exec::exec;
use virtual_exec_type::exec_ctx::RsValue;
#[test]
fn test_simple_assignment() {
let code = "a = 1; b = 2; c = 3; if a != b {d = 2;} d;";
let result = exec(code, 100).unwrap();
assert_eq!(result.get("a"), Some(&RsValue::Int(1)));
}
An example if the execution. In particular, the 100 there define the lifetime of the calculation,
which this allowed up to 100 operation, and would raise TimeoutError if it take longer than that
to execute.
The current supported operation is expression calculation, assignment and if-statement.
WIP Feature list:
x[a])while loopfor loopif statementawait in rust to allow context switching to other part of program to make it not blocking