This mimics the aliasing constructor of C++'s shared_ptr, but with a (hopefully) safe interface that doesn't let you store a reference to anything other than a reference that can be obtained from the original data.
It could be useful in situations where you only want to expose a part of an Arc or a Rc to some thread or a part of your code. Unlike general-purpose crates like yoke, this should be very simple to use.
I would greatly appreciate any code review, soundness bug reveals, and/or PRs.
Special thanks to @CAD97, @alice and @steffahn for answering on my previous posts as great information sources.
I fixed it for 0.2.0 by requiring that T: 'static. It doesn't break any usage examples, and while it's more restrictive this way, it shouldn't be in the way of any intended usage for this.
Thank you for pointing this out, I didn't realize the missing lifetime bound on the return value of the closure. I tested it with references, but it didn't occur to me to check with references to references.
I'm moderately annoyed that I couldn't figure out how to bind the return type of FnOnce to the lifetime it's using in the reference, but this shouldn't be too bad either.