pub struct Structure { /* private fields */ }Expand description
A molecular structure recovered from an InChI string.
use inchi::struct_from_inchi;
let s = struct_from_inchi("InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3")?;
assert_eq!(s.atoms().len(), 3); // two carbons and an oxygen
assert_eq!(s.bonds().len(), 2);Implementations§
Source§impl Structure
impl Structure
Sourcepub fn atoms(&self) -> &[StructureAtom]
pub fn atoms(&self) -> &[StructureAtom]
The atoms, in InChI canonical order.
let s = struct_from_inchi("InChI=1S/H2O/h1H2")?;
assert_eq!(s.atoms()[0].element, "O");
assert_eq!(s.atoms()[0].implicit_hydrogens, 2);Sourcepub fn bonds(&self) -> &[StructureBond]
pub fn bonds(&self) -> &[StructureBond]
The bonds, each listed once.
let s = struct_from_inchi("InChI=1S/CH4/h1H4")?;
assert!(s.bonds().is_empty()); // lone carbon, hydrogens are implicitTrait Implementations§
impl StructuralPartialEq for Structure
Auto Trait Implementations§
impl Freeze for Structure
impl RefUnwindSafe for Structure
impl Send for Structure
impl Sync for Structure
impl Unpin for Structure
impl UnsafeUnpin for Structure
impl UnwindSafe for Structure
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more