mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: add more test and fix warnings
This commit is contained in:
@ -65,34 +65,3 @@ where
|
||||
}
|
||||
|
||||
pub type BoxResultFuture<'a, T, E> = BoxFuture<'a, Result<T, E>>;
|
||||
|
||||
#[pin_project]
|
||||
pub struct FutureResultSend<T, E> {
|
||||
#[pin]
|
||||
pub fut: Pin<Box<dyn Future<Output = Result<T, E>> + Send>>,
|
||||
}
|
||||
|
||||
impl<T, E> FutureResultSend<T, E> {
|
||||
pub fn new<F>(f: F) -> Self
|
||||
where
|
||||
F: Future<Output = Result<T, E>> + Send + 'static,
|
||||
{
|
||||
Self {
|
||||
fut: Box::pin(async { f.await }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, E> Future for FutureResultSend<T, E>
|
||||
where
|
||||
T: Send,
|
||||
E: Debug,
|
||||
{
|
||||
type Output = Result<T, E>;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
let this = self.as_mut().project();
|
||||
let result = ready!(this.fut.poll(cx));
|
||||
Poll::Ready(result)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user