Move workspace crates into subfolder

This commit is contained in:
Dominik Werder
2023-07-10 14:45:25 +02:00
parent 8938e55f86
commit 30c7fcb1e5
212 changed files with 246 additions and 41 deletions

View File

@@ -0,0 +1,27 @@
use err::Error;
use futures_util::Stream;
use futures_util::StreamExt;
use std::pin::Pin;
use std::task::{Context, Poll};
// TODO remove after refactor.
pub struct BoxedStream<I> {
inp: Pin<Box<dyn Stream<Item = I> + Send>>,
}
impl<I> BoxedStream<I> {
pub fn new<T>(inp: T) -> Result<Self, Error>
where
T: Stream<Item = I> + Send + 'static,
{
Ok(Self { inp: Box::pin(inp) })
}
}
impl<I> Stream for BoxedStream<I> {
type Item = I;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
self.inp.poll_next_unpin(cx)
}
}