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 #[deprecated(note = "Please use .value() or .value_mut() instead. This field will be renamed to .v in the next major version")]
10 pub T,
11);
12
13impl<T: Copy> Gray_v08<T> {
14 #[allow(deprecated)]
18 pub fn value(self) -> T {
19 self.0
20 }
21
22 #[allow(deprecated)]
26 pub fn value_mut(&mut self) -> &mut T {
27 &mut self.0
28 }
29
30 #[allow(deprecated)]
32 pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_alpha::GrayAlpha_v08<T> {
33 crate::formats::gray_alpha::GrayAlpha_v08(self.0, add_alpha_value)
34 }
35}
36
37#[cfg(feature = "unstable-experimental")]
38#[allow(non_camel_case_types)]
51#[repr(C)]
52#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
53#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
54#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
55#[doc(alias = "Luma")]
56pub struct Gray_v09<T> {
57 pub v: T,
59}
60
61#[cfg(feature = "unstable-experimental")]
62impl<T> core::ops::Deref for Gray_v08<T> {
63 type Target = Gray_v09<T>;
64
65 fn deref(&self) -> &Gray_v09<T> {
66 unsafe {
67 &*(self as *const Self as *const Gray_v09::<T>)
68 }
69 }
70}
71
72#[cfg(feature = "unstable-experimental")]
73impl<T: Copy> Gray_v09<T> {
74 pub fn value(self) -> T {
78 self.v
79 }
80
81 pub fn value_mut(&mut self) -> &mut T {
85 &mut self.v
86 }
87
88 pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_a::GrayA<T> {
90 crate::formats::gray_a::GrayA { v: self.v, a: add_alpha_value }
91 }
92}
93
94#[test]
95#[cfg(feature = "unstable-experimental")]
96fn swizzle() {
97 let g = Gray_v08(10u8);
98 assert_eq!(10, g.v);
99 assert_eq!(10, g.0);
100}