Something went wrong. Try again.
A small Rust tool for viewing SMILES and SDF in modern terminals
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344#[cxx::bridge]mod ffi { unsafe extern "C++" { include!("molview/include/rdkit_bridge.hpp");
/// Return true when RDKit can parse the supplied SMILES. fn can_parse_smiles(smiles: &str) -> Result<bool>;
/// Count valid molecule records in an in-memory SDF. fn count_sdf_molecules(sdf: &[u8]) -> Result<u64>;
/// Render a SMILES molecule to PNG. fn render_smiles_png(smiles: &str) -> Result<Vec<u8>>;
/// Render all valid molecule records in an SDF to a PNG grid. fn render_sdf_png(sdf: &[u8]) -> Result<Vec<u8>>; }}
/// Check whether RDKit can parse a SMILES string.////// An RDKit C++ exception is returned as a `cxx::Exception`.pub fn can_parse_smiles(smiles: &str) -> Result<bool, cxx::Exception> { ffi::can_parse_smiles(smiles)}
/// Count the valid molecules in an SDF byte stream.////// Invalid individual records are skipped by the underlying supplier./// Structural errors that escape RDKit are returned as `cxx::Exception`.pub fn count_sdf_molecules(sdf: &[u8]) -> Result<u64, cxx::Exception> { ffi::count_sdf_molecules(sdf)}
/// Render a SMILES molecule to PNG.pub fn render_smiles_png(smiles: &str) -> Result<Vec<u8>, cxx::Exception> { ffi::render_smiles_png(smiles)}
/// Render all valid molecules in an SDF byte stream to a PNG grid.pub fn render_sdf_png(sdf: &[u8]) -> Result<Vec<u8>, cxx::Exception> { ffi::render_sdf_png(sdf)}