pub struct CompoundIdentifier { /* private fields */ }Expand description
A lightweight compound registry identifier.
Implementations§
Source§impl CompoundIdentifier
impl CompoundIdentifier
Sourcepub fn cas_number(value: &str) -> Result<Self, CompoundValidationError>
pub fn cas_number(value: &str) -> Result<Self, CompoundValidationError>
Creates a CAS Registry Number identifier.
§Errors
Returns CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub fn pub_chem_cid(value: &str) -> Result<Self, CompoundValidationError>
pub fn pub_chem_cid(value: &str) -> Result<Self, CompoundValidationError>
Creates a PubChem CID identifier.
§Errors
Returns CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub fn inchi(value: &str) -> Result<Self, CompoundValidationError>
pub fn inchi(value: &str) -> Result<Self, CompoundValidationError>
Creates an InChI identifier.
§Errors
Returns CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub fn inchi_key(value: &str) -> Result<Self, CompoundValidationError>
pub fn inchi_key(value: &str) -> Result<Self, CompoundValidationError>
Creates an InChIKey identifier.
§Errors
Returns CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub fn smiles(value: &str) -> Result<Self, CompoundValidationError>
pub fn smiles(value: &str) -> Result<Self, CompoundValidationError>
Creates a SMILES identifier.
§Errors
Returns CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub fn custom(
namespace: &str,
value: &str,
) -> Result<Self, CompoundValidationError>
pub fn custom( namespace: &str, value: &str, ) -> Result<Self, CompoundValidationError>
Creates a custom registry identifier.
§Errors
Returns CompoundValidationError::EmptyIdentifierNamespace when namespace is empty after
trimming, or CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub fn new(
registry: CompoundRegistry,
value: &str,
) -> Result<Self, CompoundValidationError>
pub fn new( registry: CompoundRegistry, value: &str, ) -> Result<Self, CompoundValidationError>
Creates an identifier from a registry and value.
§Errors
Returns CompoundValidationError::EmptyIdentifierValue when value is empty after trimming.
Sourcepub const fn registry(&self) -> &CompoundRegistry
pub const fn registry(&self) -> &CompoundRegistry
Returns the registry namespace.
Trait Implementations§
Source§impl Clone for CompoundIdentifier
impl Clone for CompoundIdentifier
Source§fn clone(&self) -> CompoundIdentifier
fn clone(&self) -> CompoundIdentifier
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more