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(test)]
11mod tests;
12
13pub use self::area::MemoryArea;
14pub use self::backend::MappingBackend;
15pub use self::set::MemorySet;
16
17#[derive(Debug, Eq, PartialEq)]
19pub enum MappingError {
20 InvalidParam,
22 AlreadyExists,
24 BadState,
26}
27
28#[cfg(feature = "axerrno")]
29impl From<MappingError> for axerrno::AxError {
30 fn from(err: MappingError) -> Self {
31 match err {
32 MappingError::InvalidParam => axerrno::AxError::InvalidInput,
33 MappingError::AlreadyExists => axerrno::AxError::AlreadyExists,
34 MappingError::BadState => axerrno::AxError::BadState,
35 }
36 }
37}
38
39pub type MappingResult<T = ()> = Result<T, MappingError>;