1 |
use std::{any::type_name, fmt::Debug};
|
2 |
|
3 |
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
4 |
use serde_json::Value;
|
5 |
|
6 |
use crate::object::GiteratedObject;
|
7 |
|
8 |
pub trait GiteratedOperation<O: GiteratedObject>: Send + Serialize + DeserializeOwned {
|
9 |
type Success: Serialize + DeserializeOwned + Send;
|
10 |
type Failure: Serialize + DeserializeOwned + Send;
|
11 |
|
12 |
fn operation_name() -> &'static str {
|
13 |
type_name::<Self>()
|
14 |
}
|
15 |
}
|
16 |
|
17 |
#[derive(Clone, Debug, Serialize, Deserialize)]
|
18 |
#[serde(transparent)]
|
19 |
#[repr(transparent)]
|
20 |
pub struct AnyOperation(pub Value);
|
21 |
|
22 |
impl<O: GiteratedObject> GiteratedOperation<O> for AnyOperation {
|
23 |
type Success = Value;
|
24 |
|
25 |
type Failure = Value;
|
26 |
}
|
27 |
|