peace_resources 0.0.13

Runtime resources for the peace automation framework.
Documentation
use std::marker::PhantomData;

use crate::states::{
    ts::{Goal, GoalStored},
    States,
};

/// Stored goal `State`s for all `Item`s.
///
/// These are the states that each item would be in, if `Item::apply` were to be
/// run with `state_goal` as the target state.
///
/// This is loaded into [`Resources`] at the beginning of any command execution,
/// from the [`StatesGoalFile`].
///
/// This is distinct from [`StatesGoal`] to address the following use cases:
///
/// * Fast and offline retrieval of the goal state.
/// * Knowing what information the user used when applying a change.
///
/// [`StatesGoalFile`]: crate::paths::StatesGoalFile
/// [`Data`]: peace_data::Data
/// [`Resources`]: crate::Resources
pub type StatesGoalStored = States<GoalStored>;

impl From<States<Goal>> for States<GoalStored> {
    fn from(states_goal: States<Goal>) -> Self {
        let States(type_map, PhantomData) = states_goal;

        Self(type_map, PhantomData)
    }
}