| 1 | use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount}; |
| 2 | use core::fmt; |
| 3 | |
| 4 | impl<T, const N: usize> fmt::Debug for Simd<T, N> |
| 5 | where |
| 6 | LaneCount<N>: SupportedLaneCount, |
| 7 | T: SimdElement + fmt::Debug, |
| 8 | { |
| 9 | /// A `Simd<T, N>` has a debug format like the one for `[T]`: |
| 10 | /// ``` |
| 11 | /// # #![feature (portable_simd)] |
| 12 | /// # #[cfg (feature = "as_crate" )] use core_simd::simd::Simd; |
| 13 | /// # #[cfg (not(feature = "as_crate" ))] use core::simd::Simd; |
| 14 | /// let floats = Simd::<f32, 4>::splat(-1.0); |
| 15 | /// assert_eq!(format!("{:?}" , [-1.0; 4]), format!("{:?}" , floats)); |
| 16 | /// ``` |
| 17 | #[inline ] |
| 18 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 19 | <[T] as fmt::Debug>::fmt(self.as_array(), f) |
| 20 | } |
| 21 | } |
| 22 | |