playdate_menu/error.rs
1use core::fmt;
2
3
4pub type ApiError = sys::error::Error<self::Error>;
5
6
7#[derive(Debug)]
8pub enum Error {
9 /// Causes when allocation failed and/or null-ptr returned.
10 Alloc,
11}
12
13impl fmt::Display for Error {
14 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 match &self {
16 Error::Alloc => write!(f, "Menu: Allocation failed"),
17 }
18 }
19}
20
21
22impl Into<ApiError> for Error {
23 fn into(self) -> ApiError { ApiError::Api(self) }
24}
25
26
27impl core::error::Error for Error {}