use peace_cfg::ApplyCheck;
use peace_resource_rt::type_reg::untagged::{BoxDtDisplay, DataType};
pub trait ItemApplyPartialRt: DataType {
fn state_current_stored(&self) -> Option<BoxDtDisplay>;
fn state_current(&self) -> Option<BoxDtDisplay>;
fn state_target(&self) -> Option<BoxDtDisplay>;
fn state_diff(&self) -> Option<BoxDtDisplay>;
fn apply_check(&self) -> Option<ApplyCheck>;
fn as_data_type(&self) -> &dyn DataType;
fn as_data_type_mut(&mut self) -> &mut dyn DataType;
}
dyn_clone::clone_trait_object!(ItemApplyPartialRt);
impl ItemApplyPartialRt for Box<dyn ItemApplyPartialRt> {
fn state_current_stored(&self) -> Option<BoxDtDisplay> {
self.as_ref().state_current_stored()
}
fn state_current(&self) -> Option<BoxDtDisplay> {
self.as_ref().state_current()
}
fn state_target(&self) -> Option<BoxDtDisplay> {
self.as_ref().state_target()
}
fn state_diff(&self) -> Option<BoxDtDisplay> {
self.as_ref().state_diff()
}
fn apply_check(&self) -> Option<ApplyCheck> {
self.as_ref().apply_check()
}
fn as_data_type(&self) -> &dyn DataType {
self.as_ref().as_data_type()
}
fn as_data_type_mut(&mut self) -> &mut dyn DataType {
self.as_mut().as_data_type_mut()
}
}
impl serde::Serialize for dyn ItemApplyPartialRt + '_ {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
erased_serde::serialize(self, serializer)
}
}