1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
use crate::zome_io::ExternIO; use crate::CallbackResult; use holochain_serialized_bytes::prelude::*; #[derive(Clone, Serialize, Deserialize, SerializedBytes, Debug)] pub enum MigrateAgent { Open, Close, } #[derive(Clone, PartialEq, Serialize, Deserialize, SerializedBytes, Debug)] pub enum MigrateAgentCallbackResult { Pass, Fail(String), } impl From<ExternIO> for MigrateAgentCallbackResult { fn from(guest_output: ExternIO) -> Self { match guest_output.decode() { Ok(v) => v, Err(e) => Self::Fail(format!("{:?}", e)), } } } impl CallbackResult for MigrateAgentCallbackResult { fn is_definitive(&self) -> bool { matches!(self, MigrateAgentCallbackResult::Fail(_)) } }