pub struct Bond {
pub a1_idx: usize,
pub a2_idx: usize,
pub order: BondOrder,
}Expand description
Undirected bond connecting two atoms within a structure.
Bonds store canonical atom indices (ascending order) so equality, hashing, and sorting remain stable regardless of the order in which the connection was created.
Fields§
§a1_idx: usizeIndex of the first atom (always the lesser index after canonicalization).
a2_idx: usizeIndex of the second atom (greater-or-equal to a1_idx).
order: BondOrderChemical multiplicity assigned to the bond.
Implementations§
Source§impl Bond
impl Bond
Sourcepub fn new(idx1: usize, idx2: usize, order: BondOrder) -> Self
pub fn new(idx1: usize, idx2: usize, order: BondOrder) -> Self
Creates a new bond while canonicalizing the endpoint ordering.
The smaller atom index is stored in a1_idx to keep hashing and equality symmetric,
ensuring duplicated bonds collapse in sets and maps.
§Arguments
idx1- Index of one bonded atom within the owningStructure.idx2- Index of the partner atom.order- Chemical bond order describing multiplicity or aromaticity.
§Returns
A Bond whose indices are sorted so a1_idx <= a2_idx.
Trait Implementations§
impl Copy for Bond
impl Eq for Bond
impl StructuralPartialEq for Bond
Auto Trait Implementations§
impl Freeze for Bond
impl RefUnwindSafe for Bond
impl Send for Bond
impl Sync for Bond
impl Unpin for Bond
impl UnwindSafe for Bond
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.