mirror of
https://github.com/dnlbauer/xdrfile.git
synced 2026-09-11 14:45:31 +00:00
New NumAtomsOutOfRange error variant
This commit is contained in:
@@ -327,8 +327,7 @@ impl Trajectory for XTCTrajectory {
|
||||
if let Some(err) = check_code(code, ErrorTask::ReadNumAtoms) {
|
||||
Err(err)
|
||||
} else {
|
||||
Ok(usize::try_from(num_atoms)
|
||||
.expect("Number of atoms in file does not fit in usize"))
|
||||
usize::try_from(num_atoms).map_err(|_| Error::NumAtomsOutOfRange(num_atoms))
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -458,8 +457,7 @@ impl Trajectory for TRRTrajectory {
|
||||
if let Some(err) = check_code(code, ErrorTask::ReadNumAtoms) {
|
||||
Err(err)
|
||||
} else {
|
||||
Ok(usize::try_from(num_atoms)
|
||||
.expect("Number of atoms in file does not fit in usize"))
|
||||
usize::try_from(num_atoms).map_err(|_| Error::NumAtomsOutOfRange(num_atoms))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user