1#![cfg_attr(not(test), no_std)]
2#![doc = include_str!("../README.md")]
3
4extern crate alloc;
5
6mod area;
7mod backend;
8mod set;
9
10#[cfg(all(axtest, feature = "axtest"))]
11pub mod axtest;
12
13#[cfg(test)]
14mod tests;
15
16pub use self::{area::MemoryArea, backend::MappingBackend, set::MemorySet};
17
18#[derive(Debug, Eq, PartialEq)]
20pub enum MappingError {
21 InvalidParam,
23 AlreadyExists,
25 BadState,
27}
28
29#[cfg(feature = "ax-errno")]
30impl From<MappingError> for ax_errno::AxError {
31 fn from(err: MappingError) -> Self {
32 match err {
33 MappingError::InvalidParam => ax_errno::AxError::InvalidInput,
34 MappingError::AlreadyExists => ax_errno::AxError::AlreadyExists,
35 MappingError::BadState => ax_errno::AxError::BadState,
36 }
37 }
38}
39
40pub type MappingResult<T = ()> = Result<T, MappingError>;