use crate::{BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason};
pub type HostState<Ext, Mem> = Option<State<Ext, Mem>>;
pub struct State<Ext, Mem> {
pub ext: Ext,
pub memory: Mem,
pub termination_reason: UndefinedTerminationReason,
}
impl<Ext: BackendExternalities, Mem> BackendTermination<Ext> for State<Ext, Mem> {
fn into_parts(self) -> (Ext, UndefinedTerminationReason) {
let State {
ext,
termination_reason,
..
} = self;
(ext, termination_reason)
}
}
impl<Ext, Mem> BackendState for State<Ext, Mem> {
fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) {
self.termination_reason = reason;
}
}