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

context: create rusb Context from existing libusb_context #135

Merged
merged 2 commits into from
Jun 4, 2022

Conversation

nev3rfail
Copy link
Contributor

@nev3rfail nev3rfail commented Jun 4, 2022

Allows to create context separately, initialize libusb, and then initialize Context with it.

The ability to create Context from existing context is necessary to use rusb with Android because on Android libusb_init should be called with special option that prevents device enumeration. More on it here.

@a1ien
Copy link
Owner

a1ien commented Jun 4, 2022

I think this function should be mark as unsafe. And we can call this function inside new for less code duplication.

@a1ien
Copy link
Owner

a1ien commented Jun 4, 2022

And also it worth mention in doc-string that you pass ownership to passed context to rust.

* mark `from_raw` unsafe;
* `new` now uses `from_raw`;
* doc-string;
@a1ien
Copy link
Owner

a1ien commented Jun 4, 2022

LGTM. Thanks.

@a1ien a1ien merged commit 6d02648 into a1ien:master Jun 4, 2022
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.

2 participants