You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So you would still implement drop? Each global call would effectively open/free the context, then. Perhaps that's ok.
But if we simply want to keep the context open (as it does currently per my understanding), why not simply have a fn global() -> UsbContext with a static holding the ref? I wonder..
This code is quite involved. In essence, it uses a modified Arc that behaves differently on drop when dealing with a libusb default (null) context.
It makes extensive use of nightly Rust (allocator related APIs mostly) so won't be suitable for projects that are averse to that.
I thought you might find it useful for the future. It's not battle-tested - more of a suggested approach.
The text was updated successfully, but these errors were encountered: