1use std::ops::{Deref, DerefMut};
2
3pub struct Dim3(pub (u32, u32, u32));
5
6impl Deref for Dim3 {
7 type Target = (u32, u32, u32);
8
9 fn deref(&self) -> &Self::Target {
10 &self.0
11 }
12}
13
14impl DerefMut for Dim3 {
15 fn deref_mut(&mut self) -> &mut Self::Target {
16 &mut self.0
17 }
18}
19
20impl Into<(u32, u32, u32)> for Dim3 {
21 fn into(self) -> (u32, u32, u32) {
22 self.0
23 }
24}
25
26impl From<(u32, u32, u32)> for Dim3 {
27 fn from(inner: (u32, u32, u32)) -> Self {
28 Self(inner)
29 }
30}
31
32impl From<(u32, u32)> for Dim3 {
33 fn from((x, y): (u32, u32)) -> Self {
34 Self((x, y, 1))
35 }
36}
37
38impl From<(u32,)> for Dim3 {
39 fn from((x,): (u32,)) -> Self {
40 Self((x, 1, 1))
41 }
42}
43
44impl From<u32> for Dim3 {
45 fn from(x: u32) -> Self {
46 Self((x, 1, 1))
47 }
48}