Chemical calculator: Difference between revisions

Content added Content deleted
m (rust example)
Line 3,886: Line 3,886:


=={{header|Rust}}==
=={{header|Rust}}==
Rust is precompiled for execution, so it has not eval for arbitrary Rust code. The `eval` crate allows Rust to process syntax similar to JSON while executing.
This allows the example to run an `eval` on strings which have been first translated into numeric arithmetic.
<syntaxhighlight lang="rust">use regex::Regex;
<syntaxhighlight lang="rust">use regex::Regex;
use eval::{eval, to_value};
use eval::{eval, to_value};