chiark / gitweb /
add Clone
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 29 Oct 2022 21:29:07 +0000 (22:29 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 29 Oct 2022 21:29:07 +0000 (22:29 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/lib.rs

index 5cf9d5f8de6aed99eba605c60962a9c7d3faa6ac..daca1664462a131a3059560889908330e64a424f 100644 (file)
@@ -40,7 +40,9 @@ pub fn shape_abut_zero(shape: &mut Shape) {
   }
 }
 
-pub fn shape_edges(shape: &Shape) -> impl Iterator<Item=[Point; 2]> + '_ {
+pub fn shape_edges(shape: &Shape)
+                   -> impl Iterator<Item=[Point; 2]> + Clone + '_
+{
   shape
     .iter()
     .cycle()
@@ -53,7 +55,9 @@ fn flip_coord(do_flip: bool, c: Coord) -> Coord {
   if do_flip { MAX-c } else { c }
 }
 
-pub fn shape_all_flippings(shape: &Shape) -> impl Iterator<Item=Shape> + '_ {
+pub fn shape_all_flippings(shape: &Shape)
+                           -> impl Iterator<Item=Shape> + Clone + '_
+{
   iter::repeat([false,true].into_iter())
     .take(DIM)
     .multi_cartesian_product()
@@ -66,7 +70,9 @@ pub fn shape_all_flippings(shape: &Shape) -> impl Iterator<Item=Shape> + '_ {
     })
 }
 
-pub fn shape_all_rotations(shape: &Shape) -> impl Iterator<Item=Shape> + '_ {
+pub fn shape_all_rotations(shape: &Shape)
+                           -> impl Iterator<Item=Shape> + Clone + '_
+{
   Itertools::cartesian_product(
     0..DIM,
     [false,true],