pub enum ParseError {
Show 21 variants
IncompleteHeader,
IncompleteFrame,
IncompleteVelocitySection,
InvalidVectorLength {
expected: usize,
found: usize,
},
InvalidNumberFormat(String),
MissingSpecVersion,
UnsupportedSpecVersion(u32),
InvalidMetadataJson(String),
IncompleteForceSection,
IncompleteEnergySection,
IncompleteSection(String),
UnknownSection(String),
ValidationError(String),
NonFiniteValue(String),
InvalidFixedFlag(String),
InvalidCount(String),
InvalidUnits(String),
UnsupportedVersion(u32),
IndexOutOfBounds {
index: usize,
len: usize,
},
MassMismatch {
symbol: String,
first_mass: f64,
found_mass: f64,
atom_index: usize,
},
Io(String),
}Variants§
IncompleteHeader
IncompleteFrame
IncompleteVelocitySection
InvalidVectorLength
InvalidNumberFormat(String)
MissingSpecVersion
UnsupportedSpecVersion(u32)
InvalidMetadataJson(String)
IncompleteForceSection
IncompleteEnergySection
IncompleteSection(String)
Declared optional section was incomplete or mislabeled.
UnknownSection(String)
ValidationError(String)
NonFiniteValue(String)
NaN, Inf, Infinity, or a signed or mixed-case spelling, in any mode. Clause CON-num.1 (D1).
InvalidFixedFlag(String)
Column 4 is not a legal integer flag. Clause CON-mask.5 (D8).
InvalidCount(String)
A count field is not an unsigned integer, or a per-type count is 0 when the type count is 1 or more. A type count of 0 is legal. Clauses CON-count.1 and CON-error.3 (D4).
InvalidUnits(String)
A unit expression is missing, mistyped, or the wrong dimension.
A minor of 1 or later with velocities and no units.time is this
class on read and on write.
Clauses CON-units.11, CON-units.12, CON-units.13, and CON-units.14 (D11).
UnsupportedVersion(u32)
Unknown major, or JSON con_spec_version 0 or 1.
Clause CON-line2.5 (D15).
IndexOutOfBounds
An in-place builder mutation
(ConFrameBuilder::set_atom_position / set_atom_velocity /
set_atom_force / set_atom_energy / set_atom_fixed /
set_atom_mass / clear_*) was called with an atom index past
the current length. Surfaces as IndexError in PyO3 and as
RKR_STATUS_INDEX_OUT_OF_BOUNDS over the C ABI.
MassMismatch
Two atoms share a CON type (symbol) but their masses differ
beyond crate::types::ConFrameBuilder::TYPE_MASS_ABS_TOL.
CON line 9 stores one mass per type, so the builder cannot
represent per-atom mass variation inside a type.
Io(String)
A sidecar read failed for a reason other than a missing file.
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn non_finite_cell(field: &str, value: impl Display) -> Self
pub fn non_finite_cell(field: &str, value: impl Display) -> Self
A cell number that is NaN or infinite, as ParseError::NonFiniteValue.
field is the name the caller knows the number by, for example
boxl[1], angles[2], cell[4], or lattice_vectors[0][2].
value is its spelling: the token of a file, or the Rust rendering of
the number (NaN, inf, -inf). Self::in_frame adds the frame.
Sourcepub fn from_cell_text(message: &str) -> Option<Self>
pub fn from_cell_text(message: &str) -> Option<Self>
Recover the typed error from the text a String-error layer carries.
For a layer that can carry only text: a Cap’n Proto failure, or the
String form of a ConvertError. A message made by to_string on
a cell error comes back as the same error; any other message gives
None.
Sourcepub fn from_non_finite_text(message: &str) -> Option<Self>
pub fn from_non_finite_text(message: &str) -> Option<Self>
Recover any ParseError::NonFiniteValue, of a cell or of an atom
row, from its to_string text. Any other message gives None.
Sourcepub fn is_non_finite_cell(&self) -> bool
pub fn is_non_finite_cell(&self) -> bool
True for the error Self::non_finite_cell makes.
Sourcepub fn named_frame(&self) -> Option<u64>
pub fn named_frame(&self) -> Option<u64>
The 0-based frame a non-finite cell error names, if it names one.
Source§impl ParseError
impl ParseError
Sourcepub fn class_name(&self) -> &'static str
pub fn class_name(&self) -> &'static str
Stable class name from the v3.1 error table (CON-error.1).
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()