Skip to main content

ax_memory_set/
lib.rs

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, backend::MappingBackend, set::MemorySet};
14
15/// Error type for memory mapping operations.
16#[derive(Debug, Eq, PartialEq, thiserror::Error)]
17pub enum MappingError {
18    /// Invalid parameter (e.g., `addr`, `size`, `flags`, etc.)
19    #[error("invalid mapping parameter")]
20    InvalidParam,
21    /// The given range overlaps with an existing mapping.
22    #[error("mapping already exists")]
23    AlreadyExists,
24    /// The backend page table is in a bad state.
25    #[error("mapping backend is in a bad state")]
26    BadState,
27}
28
29/// A [`Result`] type with [`MappingError`] as the error type.
30pub type MappingResult<T = ()> = Result<T, MappingError>;