Skip to main content

ParseError

Enum ParseError 

Source
pub enum ParseError {
Show 20 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, },
}

Variants§

§

IncompleteHeader

§

IncompleteFrame

§

IncompleteVelocitySection

§

InvalidVectorLength

Fields

§expected: usize
§found: usize
§

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.

Fields

§index: usize
§len: usize
§

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.

Fields

§symbol: String
§first_mass: f64
§found_mass: f64
§atom_index: usize

Implementations§

Source§

impl ParseError

Source

pub fn class_name(&self) -> &'static str

Stable class name from the v3.1 error table (CON-error.1).

Source

pub fn line(&self) -> u32

1-based file line when this failure is tied to a known header line. Metadata failures are line 2 of a single-frame file (CON-error.2). Other failures report the line recorded by the iterator, or 0 when the producing call did not have a cursor.

Trait Implementations§

Source§

impl Debug for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for ParseError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for ParseError

1.30.0 · Source§

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

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for ParseError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<ParseFloatError> for ParseError

Source§

fn from(e: ParseFloatError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseIntError> for ParseError

Source§

fn from(e: ParseIntError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.