use std::{any::type_name, collections::HashMap, fmt::Debug}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use crate::{ffi::FfiLabel, object::GiteratedObject}; pub trait GiteratedOperation: Send + Sync + Serialize + DeserializeOwned { type Success: Serialize + DeserializeOwned + Send; type Failure: Serialize + DeserializeOwned + Send; fn operation_name() -> &'static str { type_name::() } } #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(transparent)] #[repr(transparent)] pub struct NetworkAnyOperation(pub Vec); impl GiteratedOperation for NetworkAnyOperation { type Success = Vec; type Failure = Vec; } #[derive(Clone, Debug, Default)] pub struct OperationState { states: HashMap>, } impl FfiLabel for OperationState { fn prefix(&self) -> &'static str { "dev.giterated" } fn type_label(&self) -> &'static str { "operation_state" } }