Update:
@thepowersgang provided a working solution on the Rust Discord.
The solution entails breaking the lifetime in two, though I've yet to gain enough understanding to explain how this resolves the issue in detail. If anyone wants to elaborate that'd be great!
Here's the working playground link for anyone interested:
Original post:
Hi,
I'm in the process of prototyping a basic platform abstraction API to allows easy interaction with various devices connected to a host machine. The architecture I'm attempting to implement essentially allows a platform structure to create and store various device instances, while lending them out to an application to borrow and use the devices via a device reference which is essentially a wrapped Arc<RwLock>, I've wrapped it like this to allow storing of generalized associated data in the same structure and to provide a cleaner API to the application.
However I'm running into a lifetime error that I just can't get my head around at the moment.
I've uploaded a striped down version of what I'm trying to achieve, which produces the lifetime error I'm struggling to resolve: Rust Playground
Any help or feedback would be greatly appreciated!
Thanks,
Jasper