The singleton example uses unsafe to provide references to the static which the borrow checker cannot trace.
There are two ways we might avoud this:
- Use Arc<RefCell<...>> which might let us pass out references.
- Use a static reference in a struct.
I'm not sure either of these will work, but it should be investigated.
The singleton example uses
unsafeto provide references to the static which the borrow checker cannot trace.There are two ways we might avoud this:
I'm not sure either of these will work, but it should be investigated.