pub struct ElementSymbol(/* private fields */);Expand description
A validated chemical element symbol shape.
Implementations§
Source§impl ElementSymbol
impl ElementSymbol
Sourcepub fn new(symbol: &str) -> Result<Self, FormulaValidationError>
pub fn new(symbol: &str) -> Result<Self, FormulaValidationError>
Creates an element symbol after basic shape validation.
§Errors
Returns FormulaValidationError::InvalidSymbol when the input is not an ASCII
uppercase letter followed by zero or one ASCII lowercase letter.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the symbol and returns the owned text.
Trait Implementations§
Source§impl AsRef<str> for ElementSymbol
impl AsRef<str> for ElementSymbol
Source§impl Clone for ElementSymbol
impl Clone for ElementSymbol
Source§fn clone(&self) -> ElementSymbol
fn clone(&self) -> ElementSymbol
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 ElementSymbol
impl Debug for ElementSymbol
Source§impl Display for ElementSymbol
impl Display for ElementSymbol
Source§impl Hash for ElementSymbol
impl Hash for ElementSymbol
Source§impl Ord for ElementSymbol
impl Ord for ElementSymbol
Source§fn cmp(&self, other: &ElementSymbol) -> Ordering
fn cmp(&self, other: &ElementSymbol) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ElementSymbol
impl PartialEq for ElementSymbol
Source§impl PartialOrd for ElementSymbol
impl PartialOrd for ElementSymbol
Source§impl TryFrom<&str> for ElementSymbol
impl TryFrom<&str> for ElementSymbol
impl Eq for ElementSymbol
impl StructuralPartialEq for ElementSymbol
Auto Trait Implementations§
impl Freeze for ElementSymbol
impl RefUnwindSafe for ElementSymbol
impl Send for ElementSymbol
impl Sync for ElementSymbol
impl Unpin for ElementSymbol
impl UnsafeUnpin for ElementSymbol
impl UnwindSafe for ElementSymbol
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