New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use standard library OwnedFd
#403
Comments
I think a first step could be to implement possible traits for Could you clarify what part of dbus relies on the type implementing |
|
Ok, so |
Ah, I didn't see that was a legacy thing. I was just looking at what code in the repository breaks without the |
So yeah, if implementing those traits for the standard library type is sufficient to use that with non-legacy APIs, that should be doable enough without any breaking API changes. |
Hmm, so even if the API changes are not breaking, it does not seem easy to implement this without either bumping rust version or add additional dependencies...right? |
If it's just a a matter of implementing a few traits, |
#407 adds such an optional dependency. |
See also #410 |
Ok, so I decided to remove the |
Currently
dbus
defines anOwnedFd
type. Since a type with that name and purpose exists in std now, it would be best to use the standard type (theio-lifetimes
crate can be used to support the same thing on older compilers, if needed).This would be a breaking API change since the type is defined differently.
Looking into this, there are a few complications:
dbus
relies on the type implementingPartialOrd
, while the standardOwnedFd
doesn't. This could be addressed by a manual implementation ofPartialOrd
in types that contain aOwnedFd
, but that's awkward.dbus
also relies onClone
. While the standard library doesn't offer this and providesOwnedFd::try_clone
since the operation may fail. Similar considerations for manual implementations.dbus
provides a placeholderOwnedFd
on non-Unix platforms. Maybe instead theUnixFd
enum variant should only exist on Unix? Not sure if there are other complications.Or without API break, or having to deal with these issue, implementing
AsFd
andFrom
would offer better interoperability with the standard types, at least.The text was updated successfully, but these errors were encountered: