Iproute2, futures and running basic examples


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

While trying to run example code from https://docs.rs/iproute2/0.0.2/iproute2/#example-listing-links
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 https://stackoverflow.com/questions/58846713/and-then-method-not-found-in-futures-0-3
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.