1use cordis::CordisError;
4use cordis_include::IncludeError;
5use std::error::Error as StdError;
6use std::fmt;
7
8pub type Result<T> = std::result::Result<T, LoaderError>;
10
11#[derive(Debug)]
13pub enum LoaderError {
14 Cordis(CordisError),
16 Include(IncludeError),
18}
19
20impl fmt::Display for LoaderError {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 match self {
23 Self::Cordis(error) => write!(f, "{error}"),
24 Self::Include(error) => write!(f, "{error}"),
25 }
26 }
27}
28
29impl StdError for LoaderError {
30 fn source(&self) -> Option<&(dyn StdError + 'static)> {
31 match self {
32 Self::Cordis(error) => Some(error),
33 Self::Include(error) => Some(error),
34 }
35 }
36}
37
38impl From<CordisError> for LoaderError {
39 fn from(error: CordisError) -> Self {
40 Self::Cordis(error)
41 }
42}
43
44impl From<IncludeError> for LoaderError {
45 fn from(error: IncludeError) -> Self {
46 Self::Include(error)
47 }
48}