Expand description
A parsing library for the reaclib data format.
The data is represented by Set
, and the parsing is mostly done by Iter
.
The data can be collected into a type that implements FromIterator
, such as Vec
.
A convenience function to_hash_map
is provided for the case that you want a Vec
of all
Set
s for each reaction.
Format
The format is documented on the reaclib format help page.
There are two formats, both supported by this library.
Format
is used to indicate which version to expect.
Examples
use reaclib::{Format, Iter, Set};
use std::{fs::File, io::BufReader};
let file = File::open("reaclib")?;
let file = BufReader::new(file);
let iter = Iter::new(file, Format::Reaclib1);
let data: Vec<Set> = iter.collect::<Result<_, _>>()?;
use reaclib::{Format, Reaction, Set, to_hash_map};
use std::{collections::HashMap, io::stdin};
let input = stdin().lock();
let data: HashMap<Reaction, Vec<Set>> = to_hash_map(input, Format::Reaclib2)?;
Features
Structs
Enums
A type that describes a class of reactions with the same number of reactants and products.
A type used to specify how a reaclib file should be parsed.
A reading or parsing error.
A flag denoting whether a reaction is resonant, non-resonant, or weak.