You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some packages, in particular smol, only accepted the I/O-safety-based types instead of RawFd-based types.
While it is possible to convert a RawFd to the I/O-safe counterparts via the unsafe functions BorrowedFd::borrow_raw and OwnedFd::from_raw_fd, it is better if the unsafe operation can be hidden from the library user.
As of 0.11, only the following public types implemented AsRawFd:
Note that if we do impl AsFd for TunTapInterface, TunTapInterface::from_fd will need to be turned into an unsafe fn or accept an OwnedFd to avoid constructing a BorrowedFd from -1.
// this breaks the invariant that BorrowedFd != -1 without invoking unsafelet device = TunTapInterface::from_fd(-1,Medium::Ip,1400)?;let fd = device.as_fd();
The text was updated successfully, but these errors were encountered:
I/O Safety (rust-lang/rfcs#3128, rust-lang/rust#87074) was introduced in Rust 1.63 which associated lifetime to file descriptors.
Some packages, in particular
smol
, only accepted the I/O-safety-based types instead of RawFd-based types.While it is possible to convert a
RawFd
to the I/O-safe counterparts via the unsafe functionsBorrowedFd::borrow_raw
andOwnedFd::from_raw_fd
, it is better if the unsafe operation can be hidden from the library user.As of 0.11, only the following public types implemented
AsRawFd
:smoltcp::phy::RawSocket
smoltcp::phy::TunTapInterface
Note that if we do
impl AsFd for TunTapInterface
,TunTapInterface::from_fd
will need to be turned into anunsafe fn
or accept anOwnedFd
to avoid constructing aBorrowedFd
from -1.The text was updated successfully, but these errors were encountered: