xpict 0.3.0

Declarative molecule depiction for publication-quality vector graphics (Rust; also Python and JS)
docs.rs failed to build xpict-0.3.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

xpict (native Rust)

Molecule depiction — Rust API matching Python and JavaScript.

Single molecule: mol / render / to_svg.
Declarative document: nested DepictSpec (mol / group) — expanding toward full PictSpec.

Layout: crates.io rdkit + Depictor FFI.
Paint: xpict-core.
Docs: GitHub Pages · label markup

use xpict::{depict, mol, DepictSpec, MolNode, MolRenderOptions};

fn main() -> Result<(), xpict::Error> {
    let batch = depict(&DepictSpec::Group {
        id: None,
        children: vec![MolNode {
            smiles: Some("CCO".into()),
            ..Default::default()
        }],
    })?;

    let mut m = mol("CCO")?;
    let rendered = m.render(MolRenderOptions {
        atom_shade: Some(vec![0.0, 0.2, 0.9]),
        ..Default::default()
    })?;
    println!("{}", rendered.to_svg());
    let _ = batch;
    Ok(())
}
cargo test -p xpict

License

MIT