Skip to main content

Bond

Struct Bond 

Source
pub struct Bond { /* private fields */ }
Expand description

A chemical bond identity with optional structural descriptors.

Implementations§

Source§

impl Bond

Source

pub fn new(kind: BondKind) -> Self

Creates a bond with a kind label.

Source

pub fn between( endpoint_a: BondEndpoint, endpoint_b: BondEndpoint, kind: BondKind, ) -> Self

Creates a bond between two validated endpoint references.

Source

pub const fn kind(&self) -> BondKind

Returns the bond kind.

Source

pub const fn order(&self) -> Option<BondOrder>

Returns the optional bond order.

Source

pub fn endpoints(&self) -> &[BondEndpoint]

Returns endpoint references in insertion order.

Source

pub fn participants(&self) -> &[BondParticipant]

Returns participant references in insertion order.

Source

pub const fn polarity(&self) -> Option<BondPolarity>

Returns the optional polarity label.

Source

pub const fn strength(&self) -> Option<BondStrength>

Returns the optional strength label.

Source

pub const fn length(&self) -> Option<&BondLength>

Returns the optional bond length.

Source

pub const fn angle_label(&self) -> Option<&BondDescriptor>

Returns the optional angle label or reference.

Source

pub fn descriptors(&self) -> &[BondDescriptor]

Returns lightweight descriptors in insertion order.

Source

pub const fn with_order(self, order: BondOrder) -> Self

Assigns a bond order.

Source

pub fn with_endpoint(self, endpoint: BondEndpoint) -> Self

Adds an endpoint reference.

Source

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.

Source

pub fn with_participant(self, participant: BondParticipant) -> Self

Adds a participant reference if it is not already present.

Source

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.

Source

pub const fn with_polarity(self, polarity: BondPolarity) -> Self

Assigns a polarity label.

Source

pub const fn with_strength(self, strength: BondStrength) -> Self

Assigns a strength label.

Source

pub fn with_length(self, length: BondLength) -> Self

Assigns a bond length.

Source

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.

Source

pub fn with_angle_label(self, angle_label: BondDescriptor) -> Self

Assigns an angle label or reference.

Source

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.

Source

pub fn with_descriptor(self, descriptor: BondDescriptor) -> Self

Adds a descriptor if it is not already present.

Source

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.

Trait Implementations§

Source§

impl Clone for Bond

Source§

fn clone(&self) -> Bond

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Bond

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Bond

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Bond

Source§

fn eq(&self, other: &Bond) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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 UnsafeUnpin for Bond

§

impl UnwindSafe for Bond

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.