use std::{fmt::Debug, marker::PhantomData}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; use crate::{error::GetValueError, object::GiteratedObject, operation::GiteratedOperation}; pub trait GiteratedObjectValue: Serialize + DeserializeOwned { type Object: GiteratedObject; fn value_name() -> &'static str; } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct GetValue { pub value_name: String, pub(crate) _marker: PhantomData, } impl + Send> GiteratedOperation for GetValue { fn operation_name() -> &'static str { "get_value" } type Success = V; type Failure = GetValueError; } #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(transparent)] pub struct AnyValue { value: Value, #[serde(skip)] _marker: PhantomData, } impl AnyValue { pub unsafe fn from_raw(value: Value) -> Self { Self { value, _marker: Default::default(), } } } impl GiteratedObjectValue for AnyValue { type Object = O; fn value_name() -> &'static str { todo!() } }