Error

Enum Error 

Source
pub enum Error {
    Io {
        path: Option<PathBuf>,
        source: Error,
    },
    Parse {
        format: &'static str,
        path: Option<PathBuf>,
        line_number: usize,
        details: String,
    },
    UnknownStandardResidue {
        name: String,
        path: Option<PathBuf>,
    },
    InconsistentData {
        format: &'static str,
        path: Option<PathBuf>,
        details: String,
    },
}
Expand description

Errors that can occur while reading or writing biomolecular data.

The enum captures I/O failures, structured parser issues, unknown residues, and integrity mismatches so callers can inspect the variant and react accordingly.

Variants§

§

Io

Wrapper around operating-system level I/O failures.

Includes both filesystem and stream sources, optionally carrying the file path for richer error messages.

Fields

§path: Option<PathBuf>

Path to the file involved in the failed operation, if any.

§source: Error

Underlying error emitted by the standard library.

§

Parse

Indicates that an input line could not be parsed into the expected record.

Exposes the textual format, source path, failing line number, and an explanatory detail string to assist with debugging malformed files.

Fields

§format: &'static str

Name of the textual format (e.g., "PDB", "mmCIF").

§path: Option<PathBuf>

Path to the offending file, if known.

§line_number: usize

One-based line number where parsing failed.

§details: String

Human-readable description of what went wrong.

§

UnknownStandardResidue

Raised when an atom record references a residue not present in template libraries.

Fields

§name: String
§

InconsistentData

Reports logical inconsistencies such as mismatched atom counts or invalid records.

Fields

§format: &'static str

Name of the textual format being processed.

§path: Option<PathBuf>

Related file path when available.

§details: String

Summary of the detected inconsistency.

Implementations§

Source§

impl Error

Source

pub fn from_io(source: Error, path: Option<PathBuf>) -> Self

Constructs an Error::Io variant from a standard I/O error.

§Arguments
  • source - The original std::io::Error emitted by the OS or runtime.
  • path - Optional file path associated with the operation.
§Returns

A ready-to-use Error that preserves the source error for chaining.

Source

pub fn parse( format: &'static str, path: Option<PathBuf>, line_number: usize, details: impl Into<String>, ) -> Self

Builds a Error::Parse variant with consistent messaging.

§Arguments
  • format - Name of the textual format being parsed.
  • path - Optional path pointing to the input file.
  • line_number - Line where the failure occurred (1-indexed).
  • details - Additional context about the parsing problem.
§Returns

An Error::Parse carrying the supplied metadata.

Source

pub fn unknown_standard_residue( name: impl Into<String>, path: Option<PathBuf>, ) -> Self

Generates an Error::UnknownStandardResidue for unresolved template names.

§Arguments
  • name - Residue identifier that failed to look up.
  • path - Optional path to the source file.
§Returns

An error variant signalling the missing residue definition.

Source

pub fn inconsistent_data( format: &'static str, path: Option<PathBuf>, details: impl Into<String>, ) -> Self

Creates an Error::InconsistentData describing logical mismatches.

§Arguments
  • format - Name of the textual format being processed.
  • path - Optional file path, if applicable.
  • details - Explanation of the inconsistency.
§Returns

An error variant pointing to structural or semantic discrepancies.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V