eryon-core 0.0.4

The core modules of the eryon framework, providing essential functionality for computational entities.
/*
    Appellation: halting <module>
    Contrib: FL03 <jo3mccain@icloud.com>
*/
use crate::state::{Haltable, RawState, State};

mod impl_enum;

/// [HaltState] extends the [State] by allowing for an 'imaginary' state that is not actually
/// part of the machine's state space.
#[derive(
    Clone,
    Copy,
    Debug,
    Eq,
    Hash,
    Ord,
    PartialEq,
    PartialOrd,
    strum::EnumDiscriminants,
    strum::EnumIs,
)]
#[cfg_attr(
    feature = "serde",
    derive(serde::Deserialize, serde::Serialize),
    strum_discriminants(derive(serde::Deserialize, serde::Serialize))
)]
#[strum_discriminants(name(HaltTag), derive(Hash, Ord, PartialOrd))]
pub enum Halt<Q = usize> {
    Halt(Q),
    State(Q),
}

/*
 ************* Implementations *************
*/
impl<Q> RawState for Halt<Q>
where
    Q: RawState,
{
    seal!();
}

impl<Q> Haltable<Q> for State<Halt<Q>>
where
    Q: RawState,
{
    seal!();

    fn is_halted(&self) -> bool {
        true
    }
}