borrow-or-share
Traits for either borrowing data or sharing references.
See the documentation for a walkthrough of the crate.
TL;DR - The following code compiles
use BorrowOrShare;
;
// The returned reference, which is borrowed from `*t`, lives as long as `t`.
// The returned reference, which is copied from `t.0`, lives longer than `t`.
Credit
Credit goes to @beepster4096 for figuring out a safe version of the code.