diff --git a/src/lib.rs b/src/lib.rs index 4bf92f1..a34cec4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -145,7 +145,7 @@ macro_rules! error_from_format { }; } -#[derive(Debug)] +#[derive(Clone, Debug)] pub struct CatboxError(String); impl From 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 = std::result::Result; /// Wrapper type around SDL's [`EventPump`](sdl2::EventPump). See those docs for more info.