bladeink 1.2.5

This is a Rust port of inkle's ink, a scripting language for writing interactive narrative.
Documentation
use crate::story_error::StoryError;

#[derive(PartialEq, Clone, Copy, Eq, Hash, Debug)]
pub enum PushPopType {
    Tunnel,
    Function,
    FunctionEvaluationFromGame,
}

impl PushPopType {
    pub(crate) fn from_value(value: usize) -> Result<PushPopType, StoryError> {
        match value {
            0 => Ok(PushPopType::Tunnel),
            1 => Ok(PushPopType::Function),
            2 => Ok(PushPopType::FunctionEvaluationFromGame),
            _ => Err(StoryError::BadJson(
                "Unexpected PushPopType value".to_owned(),
            )),
        }
    }
}