shrimplify: find_locations() is not generic

This commit is contained in:
tali 2023-04-14 18:31:30 -04:00
parent ac487eec38
commit 84ba4d8145
1 changed files with 2 additions and 12 deletions

View File

@ -4,16 +4,9 @@ use alloc::vec::Vec;
use hashbrown::hash_set::HashSet; use hashbrown::hash_set::HashSet;
use mino::input::Kicks; use mino::input::Kicks;
use mino::piece::{Shape, Spawn}; use mino::piece::{Shape, Spawn};
use mino::srs::PieceType;
use mino::{input, Loc, Mat, Movement, Piece}; use mino::{input, Loc, Mat, Movement, Piece};
// Generic arguments legend
// ========================
// - T: piece type (e.g. srs::PieceType)
// - 'm: matrix lifetime
// - 'c: T::cells() lifetime
// - 'k: T::kicks() lifetime
// - 'a: general purpose lifetime
static ALL_INPUTS: &[Movement] = &[ static ALL_INPUTS: &[Movement] = &[
Movement::LEFT, Movement::LEFT,
Movement::RIGHT, Movement::RIGHT,
@ -23,10 +16,7 @@ static ALL_INPUTS: &[Movement] = &[
]; ];
/// Yields all of the locations reachable by the given peice on the given matrix. /// Yields all of the locations reachable by the given peice on the given matrix.
pub fn find_locations<'a, 'c, 'k, T>(matrix: &'a Mat, piece_ty: T) -> FindLocations<T> pub fn find_locations(matrix: &Mat, piece_ty: PieceType) -> FindLocations<'_, PieceType> {
where
T: Shape<'c> + Kicks<'k> + Spawn + Clone + 'a,
{
FindLocations::new(matrix, piece_ty) FindLocations::new(matrix, piece_ty)
} }