sokoban-elements 0.2.1

Parsing and writing Sokoban, Hexoban, Trioban and Octoban file formats.
Documentation
use crate::Direction;

/// Single step of a pusher.
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Step {
    Move(Direction),
    PushOrPull(Direction),
    Jump(Direction),
    PusherChange(Direction),
}

impl Step {
    pub fn direction(&self) -> Direction {
        match *self {
            Step::Move(direction)
            | Step::PushOrPull(direction)
            | Step::PusherChange(direction)
            | Step::Jump(direction) => direction,
        }
    }
}