use crate::{async_trait, Client, GemBytes};
use std::{
future::Future,
marker::{Send, Sync},
};
#[async_trait]
pub trait GemCall<S> {
async fn gem_call(&self, client: Client<S>) -> Vec<u8>;
}
#[async_trait]
impl<G, GF, S, FN> GemCall<S> for FN
where
G: GemBytes + Send + Sync,
GF: Future<Output = G> + Send + 'static,
S: Send + Sync + Clone + 'static,
FN: Fn(Client<S>) -> GF + Send + Sync,
{
async fn gem_call(&self, client: Client<S>) -> Vec<u8> {
(self)(client).await.gem_bytes().await
}
}