I am currently trying to write a GUI application with gtk-rs, which uses one of my own libraries, I wrote a year ago.
Now I am hitting a problem with gtk-rs, where action callbacks can be connected via closures, but these require a
’static lifetime bound.
Here a link to an example, which is pretty much a stripped down version of the problem: https://play.rust-lang.org/?gist=23c67192671c8d5d7abfd56392be1ba5&version=nightly
As you can see the I am trying to execute some action on my device, which is bound to the lifetime of the global API context via. a PhantomData in its struct definition.
Now the question: Can I work around this in my application, or do I have to change my previously written library, to use
refcounting instead of lifetimes?