Skip to content

Commit 86f286c

Browse files
committed
add convenience impls for &Vec<_> to VertexIndices
1 parent d07044d commit 86f286c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/sdl2/render.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,6 +2047,20 @@ impl<'a> From<&'a [[i32; 3]]> for VertexIndices<'a> {
20472047
}
20482048
}
20492049

2050+
macro_rules! impl_vec_ref_into_vertex_indices {
2051+
($($ty:ty)*) => {
2052+
$(
2053+
impl<'a> From<&'a Vec<$ty>> for VertexIndices<'a> {
2054+
fn from(value: &'a Vec<$ty>) -> Self {
2055+
Self::from(value.as_slice())
2056+
}
2057+
}
2058+
)*
2059+
};
2060+
}
2061+
2062+
impl_vec_ref_into_vertex_indices!(u8 u16 u32 i32 [u8; 3] [u16; 3] [u32; 3] [i32; 3]);
2063+
20502064
#[derive(Clone, Copy)]
20512065
pub struct RenderGeometryTextureParams<'a, TexCoordVertex> {
20522066
#[cfg(not(feature = "unsafe_textures"))]

0 commit comments

Comments
 (0)