Skip to content
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

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

Merged
merged 3 commits into from
May 9, 2022
Merged

Conversation

wez
Copy link

@wez wez commented May 8, 2022

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: #188

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: rust-x-bindings#188
wez added a commit to wez/xcb-imdkit-rs that referenced this pull request May 8, 2022
wez added a commit to wez/wezterm that referenced this pull request May 8, 2022
build/cg/event.rs Show resolved Hide resolved
src/base.rs Show resolved Hide resolved
@rtbo
Copy link
Collaborator

rtbo commented May 9, 2022

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

@wez
Copy link
Author

wez commented May 9, 2022

OK! Hopefully both points are now addressed!

@rtbo rtbo merged commit 58d54fa into rust-x-bindings:main May 9, 2022
@rtbo
Copy link
Collaborator

rtbo commented May 9, 2022

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider impl Raw<xcb_generic_event_t> for Event
2 participants