| 1 | #[allow(deprecated)] |
| 2 | use superrust-analyzer cargo rgb 0.8.53 legacy/internal/::pixelrust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/::ComponentSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentSlice#; |
| 3 | use superrust-analyzer cargo rgb 0.8.53 legacy/internal/::pixelrust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/::ComponentMaprust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentMap#; |
| 4 | use craterust-analyzer cargo rgb 0.8.53 crate/::altrust-analyzer cargo rgb 0.8.53 legacy/alt/::{BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#, BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#, GRBrust-analyzer cargo rgb 0.8.53 formats/grb/Grb#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#, ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#}; |
| 5 | use craterust-analyzer cargo rgb 0.8.53 crate/::{RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#, GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#}; |
| 6 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/, slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/}; |
| 7 | |
| 8 | mod arrayrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/array/; |
| 9 | mod tuplerust-analyzer cargo rgb 0.8.53 legacy/internal/convert/tuple/; |
| 10 | |
| 11 | /// Use [`::bytemuck::cast_slice()`] instead. |
| 12 | /// |
| 13 | /// Casts a slice of bytes into a slice of pixels, e.g. `[u8]` to `[RGB8]`. |
| 14 | /// |
| 15 | /// See also `FromSlice` |
| 16 | pub trait AsPixelsrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/AsPixels#<PixelType> { |
| 17 | /// Use [`::bytemuck::cast_slice()`] instead. |
| 18 | /// |
| 19 | /// Reinterpret the slice as a read-only/shared slice of pixels. |
| 20 | /// Multiple consecutive elements in the slice are intepreted as a single pixel |
| 21 | /// (depending on format, e.g. 3 for RGB, 4 for RGBA). |
| 22 | /// |
| 23 | /// Leftover elements are ignored if the slice isn't evenly divisible into pixels. |
| 24 | /// |
| 25 | /// Use this method only when the type is known from context. |
| 26 | /// See also `FromSlice`. |
| 27 | fn as_pixelsrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/AsPixels#as_pixels().(&self) -> &[PixelType]; |
| 28 | /// Use [`::bytemuck::cast_slice_mut()`] instead. |
| 29 | /// |
| 30 | /// Reinterpret the slice as a mutable/exclusive slice of pixels. |
| 31 | /// Multiple consecutive elements in the slice are intepreted as a single pixel |
| 32 | /// (depending on format, e.g. 3 for RGB, 4 for RGBA). |
| 33 | /// |
| 34 | /// Leftover elements are ignored if the slice isn't evenly divisible into pixels. |
| 35 | /// |
| 36 | /// Use this method only when the type is known from context. |
| 37 | /// See also `FromSlice`. |
| 38 | fn as_pixels_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/AsPixels#as_pixels_mut().(&mut self) -> &mut [PixelType]; |
| 39 | } |
| 40 | |
| 41 | macro_rules! as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl! { |
| 42 | ($typ:ident, $elems:expr) => { |
| 43 | impl<T> AsPixels<$typ<T>> for [T] { |
| 44 | fn as_pixels(&self) -> &[$typ<T>] { |
| 45 | unsafe { |
| 46 | slice::from_raw_parts(self.as_ptr() as *const _, self.len() / $elems) |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | fn as_pixels_mut(&mut self) -> &mut [$typ<T>] { |
| 51 | unsafe { |
| 52 | slice::from_raw_parts_mut(self.as_mut_ptr() as *mut _, self.len() / $elems) |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | }; |
| 57 | } |
| 58 | |
| 59 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, 3} |
| 60 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, 4} |
| 61 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#, 3} |
| 62 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#, 4} |
| 63 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {GRBrust-analyzer cargo rgb 0.8.53 formats/grb/Grb#, 3} |
| 64 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#, 1} |
| 65 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#, 2} |
| 66 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#, 4} |
| 67 | as_pixels_implrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/as_pixels_impl!! {ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#, 4} |
| 68 | |
| 69 | /// Use [`::bytemuck::cast_slice()`] or [`::bytemuck::from_bytes()`] to convert |
| 70 | /// |
| 71 | /// Cast a slice of component values (bytes) as a slice of RGB/RGBA pixels |
| 72 | /// |
| 73 | /// If there's any incomplete pixel at the end of the slice it is ignored. |
| 74 | pub trait FromSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#> { |
| 75 | /// Reinterpert slice as RGB pixels |
| 76 | fn as_rgbrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_rgb().(&self) -> &[RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T>]; |
| 77 | /// Reinterpert slice as RGBA pixels |
| 78 | fn as_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_rgba().(&self) -> &[RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T>]; |
| 79 | /// Reinterpert slice as alpha-first ARGB pixels |
| 80 | fn as_argbrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_argb().(&self) -> &[ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T>]; |
| 81 | /// Reinterpert mutable slice as RGB pixels |
| 82 | fn as_rgb_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_rgb_mut().(&mut self) -> &mut [RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T>]; |
| 83 | /// Reinterpert mutable slice as RGBA pixels |
| 84 | fn as_rgba_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_rgba_mut().(&mut self) -> &mut [RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T>]; |
| 85 | /// Reinterpert mutable slice as alpha-first ARGB pixels |
| 86 | fn as_argb_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_argb_mut().(&mut self) -> &mut [ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T>]; |
| 87 | |
| 88 | /// Reinterpert mutable slice as grayscale pixels |
| 89 | fn as_grayrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_gray().(&self) -> &[Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>]; |
| 90 | /// Reinterpert mutable slice as grayscale pixels with alpha |
| 91 | fn as_gray_alpharust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_gray_alpha().(&self) -> &[GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T>]; |
| 92 | /// Reinterpert mutable slice as grayscale pixels |
| 93 | fn as_gray_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_gray_mut().(&mut self) -> &mut [Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>]; |
| 94 | /// Reinterpert mutable slice as grayscale pixels with alpha |
| 95 | fn as_gray_alpha_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_gray_alpha_mut().(&mut self) -> &mut [GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T>]; |
| 96 | |
| 97 | /// Reinterpert slice as reverse-order BGR pixels |
| 98 | fn as_bgrrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_bgr().(&self) -> &[BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T>]; |
| 99 | /// Reinterpert slice as reverse-order BGRA pixels |
| 100 | fn as_bgrarust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_bgra().(&self) -> &[BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T>]; |
| 101 | /// Reinterpert slice as reverse-order ABGR pixels |
| 102 | fn as_abgrrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_abgr().(&self) -> &[ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T>]; |
| 103 | /// Reinterpert ntable slice as reverse-order BGR pixels |
| 104 | fn as_bgr_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_bgr_mut().(&mut self) -> &mut [BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T>]; |
| 105 | /// Reinterpert mutable slice as reverse-order alpha-last BGRA pixels |
| 106 | fn as_bgra_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_bgra_mut().(&mut self) -> &mut [BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T>]; |
| 107 | /// Reinterpert mutable slice as reverse-order alpha-first ABGR pixels |
| 108 | fn as_abgr_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#as_abgr_mut().(&mut self) -> &mut [ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T>]; |
| 109 | } |
| 110 | |
| 111 | impl<T: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#> FromSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/convert/FromSlice#<T> for [T] { |
| 112 | #[inline] |
| 113 | fn as_rgbrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_rgb().(&self) -> &[RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T>] { |
| 114 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 115 | } |
| 116 | |
| 117 | #[inline] |
| 118 | fn as_rgbarust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_rgba().(&self) -> &[RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T>] { |
| 119 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 120 | } |
| 121 | |
| 122 | #[inline] |
| 123 | fn as_argbrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_argb().(&self) -> &[ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T>] { |
| 124 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 125 | } |
| 126 | |
| 127 | #[inline] |
| 128 | fn as_rgb_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_rgb_mut().(&mut self) -> &mut [RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T>] { |
| 129 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 130 | } |
| 131 | |
| 132 | #[inline] |
| 133 | fn as_rgba_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_rgba_mut().(&mut self) -> &mut [RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T>] { |
| 134 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 135 | } |
| 136 | |
| 137 | #[inline] |
| 138 | fn as_argb_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_argb_mut().(&mut self) -> &mut [ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T>] { |
| 139 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 140 | } |
| 141 | |
| 142 | #[inline] |
| 143 | fn as_grayrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_gray().(&self) -> &[Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>] { |
| 144 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 145 | } |
| 146 | |
| 147 | #[inline] |
| 148 | fn as_gray_alpharust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_gray_alpha().(&self) -> &[GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T>] { |
| 149 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 150 | } |
| 151 | |
| 152 | #[inline] |
| 153 | fn as_gray_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_gray_mut().(&mut self) -> &mut [Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>] { |
| 154 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 155 | } |
| 156 | |
| 157 | #[inline] |
| 158 | fn as_gray_alpha_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_gray_alpha_mut().(&mut self) -> &mut [GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T>] { |
| 159 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 160 | } |
| 161 | |
| 162 | #[inline] |
| 163 | fn as_bgrrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_bgr().(&self) -> &[BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T>] { |
| 164 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 165 | } |
| 166 | |
| 167 | #[inline] |
| 168 | fn as_abgrrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_abgr().(&self) -> &[ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T>] { |
| 169 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 170 | } |
| 171 | |
| 172 | #[inline] |
| 173 | fn as_bgrarust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_bgra().(&self) -> &[BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T>] { |
| 174 | unsafe { from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().(self) } |
| 175 | } |
| 176 | |
| 177 | #[inline] |
| 178 | fn as_bgr_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_bgr_mut().(&mut self) -> &mut [BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#<T>] { |
| 179 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 180 | } |
| 181 | |
| 182 | #[inline] |
| 183 | fn as_bgra_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_bgra_mut().(&mut self) -> &mut [BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T>] { |
| 184 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 185 | } |
| 186 | |
| 187 | #[inline] |
| 188 | fn as_abgr_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`[T]`][`FromSlice<T>`]as_abgr_mut().(&mut self) -> &mut [ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T>] { |
| 189 | unsafe { from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().(self) } |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | #[inline(always)] |
| 194 | unsafe fn from_items_to_structrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct().<F, T>(from: &[F]) -> &[T] { |
| 195 | debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(0, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() %rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<F>()); |
| 196 | let len = from.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().(memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<F>()); |
| 197 | slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/::from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts().(from.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().().castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().::<T>(), len) |
| 198 | } |
| 199 | |
| 200 | #[inline(always)] |
| 201 | unsafe fn from_items_to_struct_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/from_items_to_struct_mut().<F, T>(from: &mut [F]) -> &mut [T] { |
| 202 | debug_assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/debug_assert_eq!!(0, memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() %rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<F>()); |
| 203 | let len = from.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().(memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<F>()); |
| 204 | slicerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/::from_raw_parts_mutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts_mut().(from.as_mut_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_mut_ptr().().castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().::<T>(), len) |
| 205 | } |
| 206 | |
| 207 | macro_rules! rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from! { |
| 208 | ($typename:ident, $from:ty, $to:ty) => { |
| 209 | impl From<$typename<$from>> for $typename<$to> { |
| 210 | #[inline(always)] |
| 211 | fn from(other: $typename<$from>) -> Self { |
| 212 | other.map(core::convert::Into::into) |
| 213 | } |
| 214 | } |
| 215 | }; |
| 216 | } |
| 217 | |
| 218 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u8,i16} |
| 219 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u8,i32} |
| 220 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u8,u16} |
| 221 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u8,u32} |
| 222 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u16,i32} |
| 223 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u16,u32} |
| 224 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u16,u64} |
| 225 | |
| 226 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u8,f32} |
| 227 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u8,f64} |
| 228 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u16,f32} |
| 229 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, u16,f64} |
| 230 | |
| 231 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, i16,f32} |
| 232 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, i16,f64} |
| 233 | |
| 234 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, i32,f64} |
| 235 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, f32,f64} |
| 236 | |
| 237 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u16,i32} |
| 238 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u16,u32} |
| 239 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u16,u64} |
| 240 | |
| 241 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u8,i16} |
| 242 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u8,u16} |
| 243 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u8,u32} |
| 244 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u8,f32} |
| 245 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u8,f64} |
| 246 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u16,f32} |
| 247 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, u16,f64} |
| 248 | |
| 249 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, i16,f32} |
| 250 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, i16,f64} |
| 251 | |
| 252 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, i32,f64} |
| 253 | rgb_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/rgb_impl_from!! {RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, f32,f64} |
| 254 | |
| 255 | macro_rules! reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from! { |
| 256 | (@rgb $t1:ident, $t2:ident) => { |
| 257 | reorder_impl_from!(@once $t1, $t2, r, g, b); |
| 258 | reorder_impl_from!(@once $t2, $t1, r, g, b); |
| 259 | }; |
| 260 | (@rgba $t1:ident, $t2:ident) => { |
| 261 | reorder_impl_from!(@once $t1, $t2, r, g, b, a); |
| 262 | reorder_impl_from!(@once $t2, $t1, r, g, b, a); |
| 263 | }; |
| 264 | (@once $t1:ident, $t2:ident, $($component:ident),+) => { |
| 265 | impl<T> From<$t1<T>> for $t2<T> where T: ::core::clone::Clone { |
| 266 | fn from(other: $t1<T>) -> Self { |
| 267 | let $t1 { $($component),+ } = other; |
| 268 | Self { |
| 269 | $($component),+ |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgba RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#); |
| 277 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgba ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#); |
| 278 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgba BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#, ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#); |
| 279 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgba BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#, ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#); |
| 280 | |
| 281 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgb RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, BGRrust-analyzer cargo rgb 0.8.53 formats/bgr/Bgr#); |
| 282 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgba BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#, RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#); |
| 283 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgba ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#, RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#); |
| 284 | reorder_impl_fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/reorder_impl_from!!(@rgb RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#, GRBrust-analyzer cargo rgb 0.8.53 formats/grb/Grb#); |
| 285 | |
| 286 | impl<T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>> for RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 287 | #[inline(always)] |
| 288 | #[allow(deprecated)] |
| 289 | fn fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`From<Gray<T>>`]from().(other: Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`From<Gray<T>>`] { |
| 290 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`From<Gray<T>>`] { |
| 291 | rrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#r.: other.clonerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`][Clone]clone().().valuerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`]value().(), |
| 292 | grust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#g.: other.clonerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`][Clone]clone().().valuerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`]value().(), |
| 293 | brust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#b.: other.valuerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`]value().(), |
| 294 | } |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | impl<T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T, u8> { |
| 299 | #[inline(always)] |
| 300 | #[allow(deprecated)] |
| 301 | fn fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T, u8>`][`From<Gray<T>>`]from().(other: Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T>) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T, u8>`][`From<Gray<T>>`] { |
| 302 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T, u8>`][`From<Gray<T>>`] { |
| 303 | rrust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#r.: other.clonerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`][Clone]clone().().valuerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`]value().(), |
| 304 | grust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#g.: other.clonerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`][Clone]clone().().valuerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`]value().(), |
| 305 | brust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#b.: other.valuerust-analyzer cargo rgb 0.8.53 formats/gray/impl#[`Gray_v09<T>`]value().(), |
| 306 | arust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#a.: 255, |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | impl<T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, A: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T, A>> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T, A> { |
| 312 | #[inline(always)] |
| 313 | #[allow(deprecated)] |
| 314 | fn fromrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T, A>`][`From<GrayAlpha<T, A>>`]from().(other: GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T, A>) -> Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T, A>`][`From<GrayAlpha<T, A>>`] { |
| 315 | Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T, A>`][`From<GrayAlpha<T, A>>`] { |
| 316 | rrust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#r.: other.vrust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#v..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 317 | grust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#g.: other.vrust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#v..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 318 | brust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#b.: other.vrust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#v..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 319 | arust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#a.: other.arust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#a..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 320 | } |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | #[cfg(not(feature = "unstable-experimental"))] |
| 325 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<T> for Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T> { |
| 326 | #[inline(always)] |
| 327 | #[allow(deprecated)] |
| 328 | fn as_ref(&self) -> &T { |
| 329 | &selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/.0 |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | #[cfg(not(feature = "unstable-experimental"))] |
| 334 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T]> for RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 335 | #[inline(always)] |
| 336 | fn as_ref(&self) -> &[T] { |
| 337 | #[allow(deprecated)] |
| 338 | ComponentSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentSlice#::as_slice(selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/) |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | #[cfg(feature = "unstable-experimental")] |
| 343 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T; 3]> for RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 344 | fn as_refrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`AsRef<[T; 3]>`]as_ref().(&self) -> &[T; 3] { |
| 345 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`AsRef<[T; 3]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | #[cfg(not(feature = "unstable-experimental"))] |
| 350 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T]> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T> { |
| 351 | #[inline(always)] |
| 352 | fn as_ref(&self) -> &[T] { |
| 353 | #[allow(deprecated)] |
| 354 | ComponentSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentSlice#::as_slice(selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/) |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | #[cfg(feature = "unstable-experimental")] |
| 359 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T; 4]> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T> { |
| 360 | fn as_refrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T>`][`AsRef<[T; 4]>`]as_ref().(&self) -> &[T; 4] { |
| 361 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T>`][`AsRef<[T; 4]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T; 4]> for ARGBrust-analyzer cargo rgb 0.8.53 formats/argb/Argb#<T> { |
| 366 | fn as_refrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`ARGB<T>`][`AsRef<[T; 4]>`]as_ref().(&self) -> &[T; 4] { |
| 367 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`ARGB<T>`][`AsRef<[T; 4]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T; 4]> for BGRArust-analyzer cargo rgb 0.8.53 formats/bgra/Bgra#<T> { |
| 372 | fn as_refrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`BGRA<T>`][`AsRef<[T; 4]>`]as_ref().(&self) -> &[T; 4] { |
| 373 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`BGRA<T>`][`AsRef<[T; 4]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T; 4]> for ABGRrust-analyzer cargo rgb 0.8.53 formats/abgr/Abgr#<T> { |
| 378 | fn as_refrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`ABGR<T>`][`AsRef<[T; 4]>`]as_ref().(&self) -> &[T; 4] { |
| 379 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`ABGR<T>`][`AsRef<[T; 4]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | #[cfg(not(feature = "unstable-experimental"))] |
| 384 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<T> for GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T> { |
| 385 | #[inline(always)] |
| 386 | #[allow(deprecated)] |
| 387 | fn as_ref(&self) -> &T { |
| 388 | &selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/.0 |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | #[cfg(feature = "unstable-experimental")] |
| 393 | impl<T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<[T; 2]> for GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T> { |
| 394 | fn as_refrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`GrayAlpha<T>`][`AsRef<[T; 2]>`]as_ref().(&self) -> &[T; 2] { |
| 395 | unsafe { &*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *const Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`GrayAlpha<T>`][`AsRef<[T; 2]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().() } |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | #[cfg(not(feature = "unstable-experimental"))] |
| 400 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<T> for Grayrust-analyzer cargo rgb 0.8.53 formats/gray/Gray_v09#<T> { |
| 401 | #[inline(always)] |
| 402 | #[allow(deprecated)] |
| 403 | fn as_mut(&mut self) -> &mut T { |
| 404 | &mut selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/.0 |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | #[cfg(not(feature = "unstable-experimental"))] |
| 409 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<[T]> for RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 410 | #[inline(always)] |
| 411 | fn as_mut(&mut self) -> &mut [T] { |
| 412 | #[allow(deprecated)] |
| 413 | ComponentSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentSlice#::as_mut_slice(selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/) |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | #[cfg(feature = "unstable-experimental")] |
| 418 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<[T; 3]> for RGBrust-analyzer cargo rgb 0.8.53 formats/rgb/Rgb#<T> { |
| 419 | fn as_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`AsMut<[T; 3]>`]as_mut().(&mut self) -> &mut [T; 3] { |
| 420 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGB<T>`][`AsMut<[T; 3]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().() } |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | #[cfg(not(feature = "unstable-experimental"))] |
| 425 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<[T]> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T> { |
| 426 | #[inline(always)] |
| 427 | fn as_mut(&mut self) -> &mut [T] { |
| 428 | #[allow(deprecated)] |
| 429 | ComponentSlicerust-analyzer cargo rgb 0.8.53 legacy/internal/pixel/ComponentSlice#::as_mut_slice(selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/) |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | #[cfg(feature = "unstable-experimental")] |
| 434 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<[T; 4]> for RGBArust-analyzer cargo rgb 0.8.53 formats/rgba/Rgba#<T> { |
| 435 | fn as_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T>`][`AsMut<[T; 4]>`]as_mut().(&mut self) -> &mut [T; 4] { |
| 436 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`RGBA<T>`][`AsMut<[T; 4]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().() } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | #[cfg(not(feature = "unstable-experimental"))] |
| 441 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<T> for GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T> { |
| 442 | #[inline(always)] |
| 443 | #[allow(deprecated)] |
| 444 | fn as_mut(&mut self) -> &mut T { |
| 445 | &mut selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/.0 |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | #[cfg(feature = "unstable-experimental")] |
| 450 | impl<T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<[T; 2]> for GrayAlpharust-analyzer cargo rgb 0.8.53 formats/gray_a/GrayA#<T> { |
| 451 | fn as_mutrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`GrayAlpha<T>`][`AsMut<[T; 2]>`]as_mut().(&mut self) -> &mut [T; 2] { |
| 452 | unsafe { &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().(self as *mut Selfrust-analyzer cargo rgb 0.8.53 legacy/internal/convert/impl#[`GrayAlpha<T>`][`AsMut<[T; 2]>`]).castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/mut_ptr/impl#[`*mut T`]cast().() } |
| 453 | } |
| 454 | } |