palette::cast

Function from_array_slice

source
pub fn from_array_slice<T>(values: &[T::Array]) -> &[T]
where T: ArrayCast,
Expand description

Cast from a slice of arrays to a slice of colors.

use palette::{cast, Srgb};

let arrays = &[[64, 139, 10], [93, 18, 214]];
assert_eq!(
    cast::from_array_slice::<Srgb<u8>>(arrays),
    &[Srgb::new(64u8, 139, 10), Srgb::new(93, 18, 214)]
)