oxidelake_memory/class.rs
1//! Host memory classes.
2
3use std::fmt;
4
5/// How a host buffer was allocated.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7#[non_exhaustive]
8pub enum MemoryClass {
9 /// Page-locked memory registered with the device driver: eligible for DMA
10 /// without staging copies.
11 Pinned,
12 /// Ordinary aligned heap memory (always available).
13 Pageable,
14}
15
16impl fmt::Display for MemoryClass {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 f.write_str(match self {
19 MemoryClass::Pinned => "pinned",
20 MemoryClass::Pageable => "pageable",
21 })
22 }
23}