Smithay / gbm.rs

libgbm bindings for rust
MIT License
30 stars 19 forks source link

Use `OwnedFd`/`BorrowedFd` instead of `RawFd` #18

Closed ids1024 closed 1 year ago

ids1024 commented 2 years ago

Device::new_from_fd() should now be safe since it takes ownership of an OwnedFd, but I guess it may be desirable for it to work without ownership of the fd? But then Device shouldn't require T: 'static.

A couple things here would be neater if drm-rs is also updated to use these types.

ids1024 commented 1 year ago

Oh, actually new_from_fd() is redundant now since OwnedFd: AsFd and BorrowedFd: AsFd. I've also dropped the 'static bound which seems unnecessary.

When https://github.com/Smithay/drm-rs/pull/132, the remaining awkward use of AsRawFd can be removed.

ids1024 commented 1 year ago

With https://github.com/Smithay/drm-rs/pull/132 merged I've removed the couple awkward implementations of AsRawFd that were still needed. Though that has it depending on drm-rs git until that's released.