Created
September 14, 2022 17:44
-
-
Save Akanoa/248270d6d00db9b32705820c3dd64a1f to your computer and use it in GitHub Desktop.
Minimal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "test_data_fusion" | |
version = "0.1.0" | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
futures = "0.3.24" | |
futures-util = "0.3.24" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::pin::Pin; | |
use std::task::{Context, Poll}; | |
use futures::Stream; | |
use futures_util::stream; | |
struct A; | |
struct B; | |
impl Stream for A { | |
type Item = A; | |
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { | |
todo!() | |
} | |
} | |
fn get_stream<'a>() -> impl Stream<Item = A> + Send + Sync + Unpin + 'a { | |
stream::iter(vec![A]) | |
} | |
struct Wrapper<X>(X); | |
impl<X> Wrapper<X> { | |
fn new(x: X) -> Self { | |
Wrapper(x) | |
} | |
} | |
impl<X> Stream for Wrapper<X> { | |
type Item = B; | |
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { | |
todo!() | |
} | |
} | |
fn execute() -> Pin<Box<dyn Stream<Item = B>>> { | |
let stream = get_stream(); | |
let wrapper = Wrapper(stream); | |
Box::pin(wrapper) | |
} | |
fn main() { | |
println!("Hello, world!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment