error[E0515]: cannot return value referencing local variable `u`
--> src/main.rs:124:38
|
124 | rmpv::ValueRef::String(u) => Some(u.as_bytes()),
| ^^^^^------------^
| | |
| | `u` is borrowed here
| returns a value referencing data owned by the current function
Without this, you can't write something like:
because the compiler (version 1.72) complains:
With this PR, things work as one would expect.