I have this code https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=6729c9584282aed7a1a89786a49dd27c which compiles and I don't know why because the return types are different.
On one side I have fn stream_string() -> impl Stream<Item = String>
But on the other side I have:
async fn get_log(&self) -> Pin<Box<dyn Stream<Item = Self::Item>>> {
Box::pin(stream_string())
}
Which returns stream_string() but they return different things (one is impl and the other is dyn)?
Why is the compiler not complaining about this?
A browser interface to the Rust compiler to experiment with the language