embassy_embedded_hal/flash/partition/
mod.rs

1//! Flash Partition utilities
2
3use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind};
4
5mod asynch;
6mod blocking;
7
8pub use asynch::Partition;
9pub use blocking::BlockingPartition;
10
11/// Partition error
12#[derive(Debug, PartialEq, Eq)]
13#[cfg_attr(feature = "defmt", derive(defmt::Format))]
14pub enum Error<T> {
15    /// The requested flash area is outside the partition
16    OutOfBounds,
17    /// Underlying flash error
18    Flash(T),
19}
20
21impl<T: NorFlashError> NorFlashError for Error<T> {
22    fn kind(&self) -> NorFlashErrorKind {
23        match self {
24            Error::OutOfBounds => NorFlashErrorKind::OutOfBounds,
25            Error::Flash(f) => f.kind(),
26        }
27    }
28}