Skip to content

Commit 81b942f

Browse files
committed
Use const generics for From<Arr> for Selection
1 parent b0fc94b commit 81b942f

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

src/hl/selection.rs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -734,27 +734,17 @@ impl From<&[Ix]> for Selection {
734734
}
735735
}
736736

737-
macro_rules! impl_fixed {
738-
() => ();
739-
740-
($head:expr, $($tail:expr,)*) => (
741-
impl From<[Ix; $head]> for Selection {
742-
fn from(points: [Ix; $head]) -> Self {
743-
points.as_ref().into()
744-
}
745-
}
746-
747-
impl From<&[Ix; $head]> for Selection {
748-
fn from(points: &[Ix; $head]) -> Self {
749-
points.as_ref().into()
750-
}
751-
}
752-
753-
impl_fixed! { $($tail,)* }
754-
)
737+
impl<const N: usize> From<[Ix; N]> for Selection {
738+
fn from(points: [Ix; N]) -> Self {
739+
points.as_ref().into()
740+
}
755741
}
756742

757-
impl_fixed! { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, }
743+
impl<const N: usize> From<&[Ix; N]> for Selection {
744+
fn from(points: &[Ix; N]) -> Self {
745+
points.as_ref().into()
746+
}
747+
}
758748

759749
macro_rules! impl_tuple {
760750
() => ();

0 commit comments

Comments
 (0)