pub struct Molecule { /* private fields */ }Expand description
An immutable molecular graph built via MoleculeBuilder.
Representation: atom list + bond list + per-atom adjacency list. No external graph library is used; all graph traversal is domain-aware.
Implementations§
Source§impl Molecule
impl Molecule
Sourcepub fn atom_count(&self) -> usize
pub fn atom_count(&self) -> usize
Number of heavy atoms (does not count implicit H).
Sourcepub fn bond_count(&self) -> usize
pub fn bond_count(&self) -> usize
Number of bonds (edges).
Sourcepub fn atom(&self, idx: AtomIdx) -> &Atom
pub fn atom(&self, idx: AtomIdx) -> &Atom
Borrow atom by index.
§Panics
Panics if idx is out of range (should not happen with indices from this molecule).
Sourcepub fn atoms(&self) -> impl Iterator<Item = (AtomIdx, &Atom)>
pub fn atoms(&self) -> impl Iterator<Item = (AtomIdx, &Atom)>
Iterate over all atoms as (AtomIdx, &Atom).
Sourcepub fn bonds(&self) -> impl Iterator<Item = (BondIdx, &BondEntry)>
pub fn bonds(&self) -> impl Iterator<Item = (BondIdx, &BondEntry)>
Iterate over all bonds as (BondIdx, &BondEntry).
Sourcepub fn neighbors(
&self,
idx: AtomIdx,
) -> impl Iterator<Item = (AtomIdx, BondIdx)> + '_
pub fn neighbors( &self, idx: AtomIdx, ) -> impl Iterator<Item = (AtomIdx, BondIdx)> + '_
Iterate over neighbors of idx as (neighbor_atom_idx, bond_idx).
Auto Trait Implementations§
impl Freeze for Molecule
impl RefUnwindSafe for Molecule
impl Send for Molecule
impl Sync for Molecule
impl Unpin for Molecule
impl UnsafeUnpin for Molecule
impl UnwindSafe for Molecule
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