#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[allow(non_camel_case_types)]
pub struct Gray_v08<T>(
pub T,
);
impl<T: Copy> Gray_v08<T> {
pub fn value(self) -> T {
self.0
}
pub fn value_mut(&mut self) -> &mut T {
&mut self.0
}
#[allow(deprecated)]
pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_alpha::GrayAlpha_v08<T> {
crate::formats::gray_alpha::GrayAlpha_v08(self.0, add_alpha_value)
}
}
#[cfg(feature = "unstable-experimental")]
#[allow(non_camel_case_types)]
#[repr(C)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[doc(alias = "Luma")]
pub struct Gray_v09<T> {
pub v: T,
}
#[cfg(feature = "unstable-experimental")]
impl<T> core::ops::Deref for Gray_v08<T> {
type Target = Gray_v09<T>;
fn deref(&self) -> &Gray_v09<T> {
unsafe {
&*(self as *const Self as *const Gray_v09::<T>)
}
}
}
#[cfg(feature = "unstable-experimental")]
impl<T: Copy> Gray_v09<T> {
pub fn value(self) -> T {
self.v
}
pub fn value_mut(&mut self) -> &mut T {
&mut self.v
}
pub fn with_alpha(self, add_alpha_value: T) -> crate::formats::gray_a::GrayA<T> {
crate::formats::gray_a::GrayA { v: self.v, a: add_alpha_value }
}
}
#[test]
#[cfg(feature = "unstable-experimental")]
fn swizzle() {
let g = Gray_v08(10u8);
assert_eq!(10, g.v);
assert_eq!(10, g.0);
}