pub struct Folio { /* private fields */ }
Expand description
The ownership of a contiguous page-aliged memory region.
To summarize:
- The memory block address is page-aligned (typically 4KB).
- The memory block size is also page-aligned.
- The memory block is physically contiguous.
§When to use
Use folio when you need a physically contiguous memory region. The common case is when you need to allocate a DMA buffer in a device driver (strictly speaking, when IOMMU is not available).
§Prefer Box<T>
over folio
Unless you need low-level control over memory allocation, use containers
like Vec<T>
or Box<T>
memory regions directly, such as DMA buffers, MMIO regions, and shared
instead of folio. Folio is intended for OS services that need to manage
memory between processes.
§You may want MappedFolio
instead
If you want to access the memory region, use MappedFolio
instead.
§Why “folio”?
Because it’s a sheet of paper (pages).
Implementations§
Auto Trait Implementations§
impl Freeze for Folio
impl RefUnwindSafe for Folio
impl Send for Folio
impl Sync for Folio
impl Unpin for Folio
impl UnwindSafe for Folio
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more