Skip to main content

mtl_gpu/enums/
heap.rs

1//! Heap enumerations.
2//!
3//! Corresponds to `Metal/MTLHeap.hpp`.
4
5use mtl_foundation::Integer;
6
7/// Heap type.
8///
9/// C++ equivalent: `MTL::HeapType`
10#[repr(transparent)]
11#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash)]
12pub struct HeapType(pub Integer);
13
14impl HeapType {
15    pub const AUTOMATIC: Self = Self(0);
16    pub const PLACEMENT: Self = Self(1);
17    pub const SPARSE: Self = Self(2);
18}
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23
24    #[test]
25    fn test_heap_type_values() {
26        assert_eq!(HeapType::AUTOMATIC.0, 0);
27        assert_eq!(HeapType::PLACEMENT.0, 1);
28        assert_eq!(HeapType::SPARSE.0, 2);
29    }
30}