impl Clone and Display for CatboxError

This commit is contained in:
Yash Karandikar 2022-06-21 15:35:56 +05:30
parent fbf2532189
commit 0d32a3d9ec
1 changed files with 7 additions and 1 deletions

View File

@ -145,7 +145,7 @@ macro_rules! error_from_format {
};
}
#[derive(Debug)]
#[derive(Clone, Debug)]
pub struct CatboxError(String);
impl From<String> for CatboxError {
@ -162,6 +162,12 @@ error_from_format! {
InitError
}
impl std::fmt::Display for CatboxError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
}
}
pub type Result<T> = std::result::Result<T, CatboxError>;
/// Wrapper type around SDL's [`EventPump`](sdl2::EventPump). See those docs for more info.