peace_rt_model 0.0.15

Runtime data types for the peace automation framework.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::outcomes::{ItemApply, ItemApplyRt};

/// A boxed `ItemApply`.
#[derive(Clone, serde::Serialize)]
pub struct ItemApplyBoxed(pub(crate) Box<dyn ItemApplyRt>);

impl<State, StateDiff> From<ItemApply<State, StateDiff>> for ItemApplyBoxed
where
    ItemApply<State, StateDiff>: ItemApplyRt,
{
    /// Returns an `ItemApplyBoxed` which erases an `ItemApply`'s type
    /// parameters.
    fn from(item_apply: ItemApply<State, StateDiff>) -> Self {
        Self(Box::new(item_apply))
    }
}

crate::outcomes::box_data_type_newtype!(ItemApplyBoxed, ItemApplyRt);