Increase type safety

This commit is contained in:
Hanno Braun 2024-11-22 19:13:00 +01:00
parent d6b5972183
commit b9c38fc6cc

View File

@ -97,11 +97,10 @@ impl Geometry<TrianglesVertex> {
}
impl<V> Geometry<V> {
pub fn new(
device: &wgpu::Device,
vertices: &[impl bytemuck::NoUninit],
indices: &[u32],
) -> Self {
pub fn new(device: &wgpu::Device, vertices: &[V], indices: &[u32]) -> Self
where
V: bytemuck::NoUninit,
{
let Ok(num_indices) = indices.len().try_into() else {
panic!("Unsupported number of indices: `{}`", indices.len());
};