1use static_assertions::assert_impl_all;
2
3#[derive(Debug, Clone)]
5#[non_exhaustive]
6pub enum SdlError {
7 UnsupportedFeature,
9 OutOfMemory,
11 Others {
13 msg: String,
15 },
16}
17
18assert_impl_all!(SdlError: Send, Sync);
19
20pub type Result<T> = std::result::Result<T, SdlError>;
22
23impl std::fmt::Display for SdlError {
24 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25 match self {
26 SdlError::UnsupportedFeature => f.write_str("the feature is unsupported"),
27 SdlError::OutOfMemory => f.write_str("out of memory"),
28 SdlError::Others { msg } => f.write_str(msg),
29 }
30 }
31}
32
33impl std::error::Error for SdlError {}