burn_dataset/dataset/
error.rs1use std::fmt;
2
3#[derive(Debug)]
10pub struct DatasetError(Box<dyn std::error::Error + Send + Sync + 'static>);
11
12impl DatasetError {
13 pub fn new<E>(err: E) -> Self
15 where
16 E: std::error::Error + Send + Sync + 'static,
17 {
18 Self(Box::new(err))
19 }
20}
21
22impl fmt::Display for DatasetError {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 write!(f, "{}", self.0)
25 }
26}
27
28impl std::error::Error for DatasetError {
29 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
30 Some(self.0.as_ref())
31 }
32}