Struct MoleculeBuilder
pub struct MoleculeBuilder { /* private fields */ }Expand description
Builder for assembling a molecule with optional explicit atom data.
Implementations§
§impl MoleculeBuilder
impl MoleculeBuilder
pub fn new(name: &str) -> MoleculeBuilder
pub fn new(name: &str) -> MoleculeBuilder
Creates a molecule builder.
pub fn formula(self, formula: ChemicalFormula) -> MoleculeBuilder
pub fn formula(self, formula: ChemicalFormula) -> MoleculeBuilder
Sets the molecule formula.
pub fn atom(self, atom: MolecularAtom) -> MoleculeBuilder
pub fn atom(self, atom: MolecularAtom) -> MoleculeBuilder
Adds an explicit atom.
pub fn connection(self, connection: AtomConnection) -> MoleculeBuilder
pub fn connection(self, connection: AtomConnection) -> MoleculeBuilder
Adds an atom connection to validate during build.
pub const fn charge(self, charge: MoleculeCharge) -> MoleculeBuilder
pub const fn charge(self, charge: MoleculeCharge) -> MoleculeBuilder
Sets the formal molecule charge.
pub fn kind(self, kind: MoleculeKind) -> MoleculeBuilder
pub fn kind(self, kind: MoleculeKind) -> MoleculeBuilder
Adds a kind label if it is not already present.
pub 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§
§impl Clone for MoleculeBuilder
impl Clone for MoleculeBuilder
§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 more§impl Debug for MoleculeBuilder
impl Debug for MoleculeBuilder
§impl Default for MoleculeBuilder
impl Default for MoleculeBuilder
§fn default() -> MoleculeBuilder
fn default() -> MoleculeBuilder
Returns the “default value” for a type. Read more
§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