#[non_exhaustive]pub enum FormulaError {
ParseError {
pos: usize,
message: String,
},
UnknownElement(String),
NoAbundanceData(u32),
Core(Error),
}Expand description
Errors from formula parsing and element expansion.
Distinct from the crate-level crate::Error so that the parser can
report byte positions and unknown symbols without polluting the shared
composition-error set; mass-table failures are wrapped in Self::Core.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ParseError
The formula is not valid under the supported grammar (see
parse_formula).
Fields
UnknownElement(String)
An element symbol was not recognized (case-sensitive).
NoAbundanceData(u32)
An element has no tabulated natural isotopes to expand into.
Core(Error)
A composition-level failure (e.g. missing atomic mass).
Trait Implementations§
Source§impl Debug for FormulaError
impl Debug for FormulaError
Source§impl Display for FormulaError
impl Display for FormulaError
Source§impl Error for FormulaError
impl Error for FormulaError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for FormulaError
impl !UnwindSafe for FormulaError
impl Freeze for FormulaError
impl Send for FormulaError
impl Sync for FormulaError
impl Unpin for FormulaError
impl UnsafeUnpin for FormulaError
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