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
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
UnknownStandardResidue
Raised when an atom record references a residue not present in template libraries.
InconsistentData
Reports logical inconsistencies such as mismatched atom counts or invalid records.
Implementations§
Source§impl Error
impl Error
Sourcepub fn parse(
format: &'static str,
path: Option<PathBuf>,
line_number: usize,
details: impl Into<String>,
) -> Self
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.
Sourcepub fn unknown_standard_residue(
name: impl Into<String>,
path: Option<PathBuf>,
) -> Self
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.
Sourcepub fn inconsistent_data(
format: &'static str,
path: Option<PathBuf>,
details: impl Into<String>,
) -> Self
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 Error for Error
impl Error for Error
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
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> 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
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.