Skip to main content

sokoban_elements/game_board/
edges.rs

1/// Horizontal edge of a [`GameBoard`](crate::GameBoard): the edge rows are added to and removed
2/// from.
3///
4/// Named after the orientation of the edge itself - the top of a board is a horizontal line.
5///
6/// # Examples
7///
8/// ```rust
9/// use sokoban_elements::*;
10///
11/// let mut board = GameBoard::new(3, 3, Tessellation::Sokoban);
12///
13/// board.add_rows(HorizontalEdge::Top, 2);
14/// assert_eq!(board.height(), 5);
15/// ```
16#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
17#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
18pub enum HorizontalEdge {
19    Top,
20    Bottom,
21}
22
23/// Vertical edge of a [`GameBoard`](crate::GameBoard): the edge columns are added to and removed
24/// from.
25///
26/// Named after the orientation of the edge itself - the left side of a board is a vertical line.
27///
28/// # Examples
29///
30/// ```rust
31/// use sokoban_elements::*;
32///
33/// let mut board = GameBoard::new(3, 3, Tessellation::Sokoban);
34///
35/// board.remove_columns(VerticalEdge::Left, 1);
36/// assert_eq!(board.width(), 2);
37/// ```
38#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
39#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
40pub enum VerticalEdge {
41    Left,
42    Right,
43}