Iproute2, futures and running basic examples

Hello.

$ rustc --version
rustc 1.48.0 (7eac88abb 2020-11-16)

While trying to run example code from iproute2 - Rust
I'm catching an error

error[E0599]: no method named `and_then` found for opaque type `impl futures::future::Future` in the current scope
  --> src/main.rs:18:49
   |
18 |     let request = handle.link().get().execute().and_then(|links| {
   |                                                 ^^^^^^^^ method not found in `impl futures::future::Future`

Then I googled rust - and_then method not found in futures 0.3 - Stack Overflow
that I should use trait for TryFutureExt. So I tried to proceed with my understanding and didn't make it work in code.
I'm quite new in programming rust. Please help.

p.s. Also I have problem around

core.handle().spawn(connection.map_err(|_| ()));

but this one will be for future me.

The iproute2 crate was renamed to rtnetlink. The versions published under the previous name are very old, and require outdated versions of the futures libraries.

Try out the latest version of the rtnetlink crate, which works with futures 0.3. There are examples in its GitHub repository.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.