add async feature #1

Merged
b4tman merged 62 commits from async into master 2023-08-18 06:29:46 +00:00
Showing only changes of commit 07d7ba50cc - Show all commits

View File

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