Crate chemistry_parser

Crate chemistry_parser 

Source
Expand description

§Chemistry Parsing Library

This library provides tools to parse and work with chemical elements, formulas, and equations.

§Example Usage

§Simple pest parse

use pest::Parser;
use chemistry_parser::{ChemParser, Rule};

let chemical_equation = ChemParser::parse(Rule::equation, "2H2 + O2 -> 2H2O").unwrap();

§Parse to Rust struct

use chemistry_parser::ChemParser;

let parser = ChemParser::new();
let equation_struct = parser.parse_equation("2H2 + O2 -> 2H2O").unwrap();
println!("{}", equation_struct);

Modules§

element
Chemical units Module

Structs§

ChemParser
Parser for chemical elements, formulas, and equations.

Enums§

ChemParseError
Represents possible errors in chemical parsing.
Rule
Grammar rules for parsing chemical elements, formulas and equations