JavaScript is disabled, refresh for a better experience. ambee/giterated

ambee/giterated

Git repository hosting, collaboration, and discovery for the Fediverse.

Fixed imports!

Amber - ⁨2⁩ years ago

parent: tbd commit: ⁨ef0e853

⁨giterated-models/src/operation.rs⁩ - ⁨691⁩ bytes
Raw
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 = Vec<u8>;
24
25 type Failure = Vec<u8>;
26 }
27