use crate::formats::gray_a::GrayA;
use core::ops::Deref;
#[repr(C)]
#[cfg_attr(feature = "unstable-experimental", deprecated(note = "renamed to GrayA"))]
#[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 GrayAlpha_v08<T, A = T>(
pub T,
pub A,
);
impl<T: Copy> GrayAlpha_v08<T> {
pub fn value(self) -> T {
self.0
}
}
impl<T, A> Deref for GrayAlpha_v08<T, A> {
type Target = GrayA<T, A>;
fn deref(&self) -> &GrayA<T, A> {
unsafe {
&*(self as *const Self as *const GrayA::<T, A>)
}
}
}
#[test]
fn swizzle() {
let g = GrayAlpha_v08(10u8, 20u8);
assert_eq!(10, g.v);
assert_eq!(20, g.a);
}