purr 0.1.0

Primitives for reading the SMILES language in Rust.
Documentation

Purr

Primitives for reading the SMILES language in Rust. For details, see: Let's Build a SMILES Parser in Rust.

Usage

Add this to your Cargo.toml:

[dependencies]
purr = "0.1"

Examples

Parse ethane:

use purr::{ smiles_to_mol, Mol, Atom, Bond, Element };

fn main() {
    let mol = smiles_to_mol(&"CC").unwrap();

    assert_eq!(mol, Mol {
        atoms: vec![
            Atom { element: Element::C, ..Default::default() },
            Atom { element: Element::C, ..Default::default() }
        ],
        bonds: vec![
            vec![ Bond { tid: 1, style: None } ],
            vec![ Bond { tid: 0, style: None } ]
        ]
    });
}

Versions

Purr is not yet stable. Patch versions never introduce breaking changes, but minor/major versions probably will.

License

Purr is distributed under the terms of the MIT License. See LICENSE-MIT and COPYRIGHT for details.