doesnt work :(

This commit is contained in:
Lucas Nogueira
2024-03-27 21:36:00 -03:00
parent a1fae1baf3
commit 1cb0d8e521

View File

@@ -246,7 +246,7 @@ pub mod private {
}
}
// ===== Result<impl Serialize, impl Into<InvokeError>> =====
// ===== Result<impl IpcResponse, impl Into<InvokeError>> =====
pub struct ResultTag(InvokeResponse);
@@ -293,6 +293,28 @@ pub mod private {
}
}
// ===== Future<Output = Vec<u8>> =====
pub struct BufferFutureTag<F: Future<Output = Vec<u8>>>(Pin<Box<F>>);
pub trait BufferFutureKind<F: Future<Output = Vec<u8>>> {
fn async_kind(self) -> BufferFutureTag<F>;
}
impl<F: Future<Output = Vec<u8>>> BufferFutureKind<F> for F {
#[inline(always)]
fn async_kind(self) -> BufferFutureTag<F> {
BufferFutureTag(Box::pin(self))
}
}
impl<F: Future<Output = Vec<u8>>> BufferFutureTag<F> {
#[inline(always)]
pub fn future(self) -> impl Future<Output = Result<InvokeResponseBody, InvokeError>> {
self.0.map(|value| Ok(InvokeResponseBody::Raw(value)))
}
}
// ===== Future<Output = impl IpcResponse> =====
pub struct FutureTag<T: IpcResponse, F: Future<Output = T>>(Pin<Box<F>>);