pub struct Bond { /* private fields */ }Expand description
A chemical bond identity with optional structural descriptors.
Implementations§
Source§impl Bond
impl Bond
Sourcepub fn between(
endpoint_a: BondEndpoint,
endpoint_b: BondEndpoint,
kind: BondKind,
) -> Self
pub fn between( endpoint_a: BondEndpoint, endpoint_b: BondEndpoint, kind: BondKind, ) -> Self
Creates a bond between two validated endpoint references.
Sourcepub fn endpoints(&self) -> &[BondEndpoint]
pub fn endpoints(&self) -> &[BondEndpoint]
Returns endpoint references in insertion order.
Sourcepub fn participants(&self) -> &[BondParticipant]
pub fn participants(&self) -> &[BondParticipant]
Returns participant references in insertion order.
Sourcepub const fn polarity(&self) -> Option<BondPolarity>
pub const fn polarity(&self) -> Option<BondPolarity>
Returns the optional polarity label.
Sourcepub const fn strength(&self) -> Option<BondStrength>
pub const fn strength(&self) -> Option<BondStrength>
Returns the optional strength label.
Sourcepub const fn length(&self) -> Option<&BondLength>
pub const fn length(&self) -> Option<&BondLength>
Returns the optional bond length.
Sourcepub const fn angle_label(&self) -> Option<&BondDescriptor>
pub const fn angle_label(&self) -> Option<&BondDescriptor>
Returns the optional angle label or reference.
Sourcepub fn descriptors(&self) -> &[BondDescriptor]
pub fn descriptors(&self) -> &[BondDescriptor]
Returns lightweight descriptors in insertion order.
Sourcepub const fn with_order(self, order: BondOrder) -> Self
pub const fn with_order(self, order: BondOrder) -> Self
Assigns a bond order.
Sourcepub fn with_endpoint(self, endpoint: BondEndpoint) -> Self
pub fn with_endpoint(self, endpoint: BondEndpoint) -> Self
Adds an endpoint reference.
Sourcepub fn try_with_endpoint(
self,
endpoint: &str,
) -> Result<Self, BondValidationError>
pub fn try_with_endpoint( self, endpoint: &str, ) -> Result<Self, BondValidationError>
Adds an endpoint reference after validation.
§Errors
Returns BondValidationError::EmptyEndpointLabel when endpoint is empty after trimming.
Sourcepub fn with_participant(self, participant: BondParticipant) -> Self
pub fn with_participant(self, participant: BondParticipant) -> Self
Adds a participant reference if it is not already present.
Sourcepub fn try_with_participant(
self,
participant: &str,
) -> Result<Self, BondValidationError>
pub fn try_with_participant( self, participant: &str, ) -> Result<Self, BondValidationError>
Adds a participant reference after validation.
§Errors
Returns BondValidationError::EmptyParticipantLabel when participant is empty after
trimming.
Sourcepub const fn with_polarity(self, polarity: BondPolarity) -> Self
pub const fn with_polarity(self, polarity: BondPolarity) -> Self
Assigns a polarity label.
Sourcepub const fn with_strength(self, strength: BondStrength) -> Self
pub const fn with_strength(self, strength: BondStrength) -> Self
Assigns a strength label.
Sourcepub fn with_length(self, length: BondLength) -> Self
pub fn with_length(self, length: BondLength) -> Self
Assigns a bond length.
Sourcepub fn try_with_length(
self,
value: f64,
unit: &str,
) -> Result<Self, BondValidationError>
pub fn try_with_length( self, value: f64, unit: &str, ) -> Result<Self, BondValidationError>
Assigns a bond length after validation.
§Errors
Returns BondValidationError when the length value is not finite, is not positive, or the
unit is empty after trimming.
Sourcepub fn with_angle_label(self, angle_label: BondDescriptor) -> Self
pub fn with_angle_label(self, angle_label: BondDescriptor) -> Self
Assigns an angle label or reference.
Sourcepub fn try_with_angle_label(
self,
angle_label: &str,
) -> Result<Self, BondValidationError>
pub fn try_with_angle_label( self, angle_label: &str, ) -> Result<Self, BondValidationError>
Assigns an angle label or reference after validation.
§Errors
Returns BondValidationError::EmptyAngleLabel when angle_label is empty after trimming.
Sourcepub fn with_descriptor(self, descriptor: BondDescriptor) -> Self
pub fn with_descriptor(self, descriptor: BondDescriptor) -> Self
Adds a descriptor if it is not already present.
Sourcepub fn try_with_descriptor(
self,
descriptor: &str,
) -> Result<Self, BondValidationError>
pub fn try_with_descriptor( self, descriptor: &str, ) -> Result<Self, BondValidationError>
Adds a descriptor after validation.
§Errors
Returns BondValidationError::EmptyDescriptor when descriptor is empty after trimming.