1#[repr(C)]
2#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
4#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
5#[allow(non_camel_case_types)]
7pub struct Gray_v08<T>(
8 pub T,
10);
11
12impl<T: Copy> Gray_v08<T> {
13 pub fn value(self) -> T {
17 self.0
18 }
19
20 pub fn value_mut(&mut self) -> &mut T {
24 &mut self.0
25 }
26
27 #[allow(deprecated)]
29 pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_alpha::GrayAlpha_v08<T> {
30 crate::formats::gray_alpha::GrayAlpha_v08(self.0, add_alpha_value)
31 }
32}
33
34#[cfg(feature = "unstable-experimental")]
35#[allow(non_camel_case_types)]
48#[repr(C)]
49#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
50#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
51#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
52#[doc(alias = "Luma")]
53pub struct Gray_v09<T> {
54 pub v: T,
56}
57
58#[cfg(feature = "unstable-experimental")]
59impl<T> core::ops::Deref for Gray_v08<T> {
60 type Target = Gray_v09<T>;
61
62 fn deref(&self) -> &Gray_v09<T> {
63 unsafe {
64 &*(self as *const Self as *const Gray_v09::<T>)
65 }
66 }
67}
68
69#[cfg(feature = "unstable-experimental")]
70impl<T: Copy> Gray_v09<T> {
71 pub fn value(self) -> T {
75 self.v
76 }
77
78 pub fn value_mut(&mut self) -> &mut T {
82 &mut self.v
83 }
84
85 pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_a::GrayA<T> {
87 crate::formats::gray_a::GrayA { v: self.v, a: add_alpha_value }
88 }
89}
90
91#[test]
92#[cfg(feature = "unstable-experimental")]
93fn swizzle() {
94 let g = Gray_v08(10u8);
95 assert_eq!(10, g.v);
96 assert_eq!(10, g.0);
97}