rust-x-bindings / rust-xcb

Rust bindings and wrapper for XCB.
MIT License
162 stars 64 forks source link

Add Event::as_raw(), Connection::resolve_event() #190

Closed wez closed 2 years ago

wez commented 2 years ago

In some ffi scenarios it is necessary to extract the underlying event pointer. The Event::as_raw method serves this purpose.

I couldn't implement the Raw<> trait for Event because the from_raw method requires additional context in order to perform the inverse of the as_raw method, so Event::as_raw is just a standalone method.

I added Connection::resolve_event as the inverse operation to give some symmetry.

closes: https://github.com/rust-x-bindings/rust-xcb/issues/188

rtbo commented 2 years ago

LGTM besides the point about doc comment. You also need to run cargo fmt

wez commented 2 years ago

OK! Hopefully both points are now addressed!

rtbo commented 2 years ago

Thank you