From: Joshua Simmons Date: Thu, 3 Nov 2022 21:17:30 +0000 (+0100) Subject: Allow creating vulkan slices from mut slices X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=9af9577e3fa8cb66a977ae981efeb4861487280c;p=josh%2Fnarcissus Allow creating vulkan slices from mut slices --- diff --git a/ffi/vulkan-sys/src/lib.rs b/ffi/vulkan-sys/src/lib.rs index 7eeba0c..34ecaf7 100644 --- a/ffi/vulkan-sys/src/lib.rs +++ b/ffi/vulkan-sys/src/lib.rs @@ -166,6 +166,25 @@ where } } +impl<'a, I, T, const PAD: usize> From<&'a mut [T]> for VulkanSlice1<'a, I, T, PAD> +where + I: TryFrom, +{ + fn from(x: &'a mut [T]) -> Self { + (x as &[_]).into() + } +} + +impl<'a, I, T, const N: usize, const PAD: usize> From<&'a mut [T; N]> + for VulkanSlice1<'a, I, T, PAD> +where + I: TryFrom, +{ + fn from(x: &'a mut [T; N]) -> Self { + (x as &[T; N]).into() + } +} + #[repr(C)] #[repr(packed(4))] pub struct VulkanSlice2<'a, I, T0, T1, const PAD: usize> {