| Crates.io | reaclib |
| lib.rs | reaclib |
| version | 0.1.3 |
| created_at | 2022-10-21 06:44:17.497077+00 |
| updated_at | 2022-11-14 04:29:35.776538+00 |
| description | A parsing library for the reaclib format |
| homepage | |
| repository | https://github.com/j-browne/reaclib-rs |
| max_upload_size | |
| id | 693225 |
| size | 71,849 |
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
Sets for each reaction.
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.
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)?;
serde: Provide Serialize and Deserialize implementations for serde.arbitrary: Provide Arbitrary implementations for arbitrary, useful for fuzzing.Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.