1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/// Struct representing the success or failure of an order.
/// The meaning of success and failure is contextually-dependent,
/// and should be derived from the outcome map of a resolution cycle.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OrderState {
/// For move commands, the order results in a move.
/// For all other commands, the unit is not dislodged.
Succeeds,
Fails,
}
impl From<bool> for OrderState {
fn from(b: bool) -> Self {
if b {
OrderState::Succeeds
} else {
OrderState::Fails
}
}
}
impl From<OrderState> for bool {
fn from(os: OrderState) -> Self {
match os {
OrderState::Succeeds => true,
OrderState::Fails => false,
}
}
}