pub struct MoleculeBuilder { /* private fields */ }Expand description
Builder for assembling a molecule with optional explicit atom data.
Implementations§
Source§impl MoleculeBuilder
impl MoleculeBuilder
Sourcepub fn atom(self, atom: MolecularAtom) -> Self
pub fn atom(self, atom: MolecularAtom) -> Self
Adds an explicit atom.
Sourcepub fn connection(self, connection: AtomConnection) -> Self
pub fn connection(self, connection: AtomConnection) -> Self
Adds an atom connection to validate during build.
Sourcepub const fn charge(self, charge: MoleculeCharge) -> Self
pub const fn charge(self, charge: MoleculeCharge) -> Self
Sets the formal molecule charge.
Sourcepub fn kind(self, kind: MoleculeKind) -> Self
pub fn kind(self, kind: MoleculeKind) -> Self
Adds a kind label if it is not already present.
Sourcepub fn build(self) -> Result<Molecule, MoleculeValidationError>
pub fn build(self) -> Result<Molecule, MoleculeValidationError>
Builds the molecule.
§Errors
Returns MoleculeValidationError::EmptyName for an empty name,
MoleculeValidationError::MissingFormula if no formula was assigned, or
MoleculeValidationError::InvalidConnectionIndex when a connection references an atom
index outside the explicit atom list.
Trait Implementations§
Source§impl Clone for MoleculeBuilder
impl Clone for MoleculeBuilder
Source§fn clone(&self) -> MoleculeBuilder
fn clone(&self) -> MoleculeBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MoleculeBuilder
impl Debug for MoleculeBuilder
Source§impl Default for MoleculeBuilder
impl Default for MoleculeBuilder
Source§fn default() -> MoleculeBuilder
fn default() -> MoleculeBuilder
Returns the “default value” for a type. Read more
Source§impl PartialEq for MoleculeBuilder
impl PartialEq for MoleculeBuilder
impl Eq for MoleculeBuilder
impl StructuralPartialEq for MoleculeBuilder
Auto Trait Implementations§
impl Freeze for MoleculeBuilder
impl RefUnwindSafe for MoleculeBuilder
impl Send for MoleculeBuilder
impl Sync for MoleculeBuilder
impl Unpin for MoleculeBuilder
impl UnsafeUnpin for MoleculeBuilder
impl UnwindSafe for MoleculeBuilder
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