Skip to main content

embassy_utils/flash/
err.rs

1use core::num::TryFromIntError;
2use embassy_rp_plus::embassy_rp::flash;
3
4/// re type
5pub type FlashResult<T> = Result<T, FlashError>;
6
7/// flash error
8#[derive(Debug)]
9pub enum FlashError {
10    /// flash error
11    FlashError(flash::Error),
12    /// try from error
13    TryFromIntError(TryFromIntError),
14}
15
16/// support flash error into flash error
17impl From<flash::Error> for FlashError {
18    #[inline]
19    fn from(value: flash::Error) -> Self {
20        Self::FlashError(value)
21    }
22}
23
24/// support try from int error to flash error
25impl From<TryFromIntError> for FlashError {
26    #[inline]
27    fn from(value: TryFromIntError) -> Self {
28        Self::TryFromIntError(value)
29    }
30}