Skip to content

Instantly share code, notes, and snippets.

@Gottox
Created December 22, 2019 16:03
Show Gist options
  • Save Gottox/6520e3fc9de71b1843ec427c2a445754 to your computer and use it in GitHub Desktop.
Save Gottox/6520e3fc9de71b1843ec427c2a445754 to your computer and use it in GitHub Desktop.
Compiling testproject v0.1.0 (/tmp/testproject)
error[E0599]: no method named `filter_map` found for type `tokio::net::tcp::incoming::Incoming<'_>` in the current scope
--> src/main.rs:6:29
|
6 | rev_listener.incoming().filter_map(|x| x.ok());
| ^^^^^^^^^^ method not found in `tokio::net::tcp::incoming::Incoming<'_>`
|
= note: the method `filter_map` exists but the following trait bounds were not satisfied:
`&mut tokio::net::tcp::incoming::Incoming<'_> : std::iter::Iterator`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: could not compile `testproject`.
To learn more, run the command again with --verbose.
use tokio::net::TcpListener;
use std::error::Error;
async fn listen() -> Result<(), Box<dyn Error>> {
let mut rev_listener = TcpListener::bind("127.0.0.1:8000").await?;
rev_listener.incoming().filter_map(|x| x.ok());
Ok(())
}
#[tokio::main]
async fn main() {
listen().await;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment