add async feature #1

Merged
b4tman merged 62 commits from async into master 2023-08-18 06:29:46 +00:00
14 changed files with 2495 additions and 325 deletions
Showing only changes of commit 07d7ba50cc - Show all commits

@@ -146,6 +146,8 @@ where
use pin_project::pin_project;
#[pin_project]
/// FIXME: not really async
/// only work when ..push.poll() returns Ready immediately
pub struct WriterSink<'a, T>
where
T: bincode::Encode,
@@ -173,7 +175,7 @@ where
let item = this.item.take().unwrap();
let push_fut = this.writer.push(item);
let push_fut = this.writer.push(item); // FIXME:: how to save this future???
pin_mut!(push_fut);
push_fut.poll(ctx)
}
@@ -333,6 +335,7 @@ where
return Poll::Ready(None);
}
// FIXME: mayby work only if reader.get().poll() return Ready immediately
let future = self.reader.get(self.index.unwrap());
pin_mut!(future);
match Pin::new(&mut future).poll(cx) {