I tried this.
enum BlockType {
I, O, T, J, L, S, Z
}
impl From<BlockType> for [(usize, usize); 4] {
fn from(inp: BlockType) -> Self {
match inp {
BlockType::O => [(0, 0), (1, 0), (1, 1), (0, 1)],
BlockType::I => [(0, 0), (0, 1), (0, 2), (0, 3)],
BlockType::T => [(0, 0), (1, 0), (2, 0), (1, 1)],
BlockType::Z => [(0, 0), (0, 1), (1, 1), (1, 2)],
BlockType::S => (BlockType::Z.into() as [(usize, usize); 4]).map(|(x, y)| (y, x)),
BlockType::L => [(0, 0), (0, 1), (0, 2), (1, 0)],
BlockType::J => BlockType::S.into::<[(usize, usize); 4]>().map(|(x, y)| (y, x)),
}
}
}
This is not compiling.
How to specify return type in into()