forked from Orchid/orchid
base and extension fully compiles, host in good shape
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::future::Future;
|
||||
|
||||
use super::coding::Coding;
|
||||
use crate::helpers::enc_vec;
|
||||
|
||||
@@ -5,9 +7,12 @@ pub trait Request: Coding + Sized + Send + 'static {
|
||||
type Response: Coding + Send + 'static;
|
||||
}
|
||||
|
||||
pub fn respond<R: Request>(_: &R, rep: R::Response) -> Vec<u8> { enc_vec(&rep) }
|
||||
pub fn respond_with<R: Request>(r: &R, f: impl FnOnce(&R) -> R::Response) -> Vec<u8> {
|
||||
respond(r, f(r))
|
||||
pub async fn respond<R: Request>(_: &R, rep: R::Response) -> Vec<u8> { enc_vec(&rep).await }
|
||||
pub async fn respond_with<R: Request, F: Future<Output = R::Response>>(
|
||||
r: &R,
|
||||
f: impl FnOnce(&R) -> F,
|
||||
) -> Vec<u8> {
|
||||
respond(r, f(r).await).await
|
||||
}
|
||||
|
||||
pub trait Channel: 'static {
|
||||
|
||||
Reference in New Issue
Block a user