messense / if-addrs

Retrieve IP addresses for all interfaces. POSIX & Windows
BSD 3-Clause "New" or "Revised" License
22 stars 15 forks source link

Version 0.13.0 broken on platforms where `libc::suseconds_t` != `i64` #39

Closed ravenclaw900 closed 4 weeks ago

ravenclaw900 commented 4 weeks ago

On 32-bit platforms, libc::suseconds_t is usually i32 instead of i64. This results in a compilation error like the one below, since u32 cannot be converted into i32 without the risk of wrapping.

 error[E0277]: the trait bound `i32: From<u32>` is not satisfied
  --> /cargo/registry/src/index.crates.io-6f17d22bba15001f/if-addrs-0.13.0/src/posix_not_mac.rs:75:50
   |
75 |                 tv_usec: timeout.subsec_micros().into(),
   |                                                  ^^^^ the trait `From<u32>` is not implemented for `i32`, which is required by `u32: Into<_>`
   |