Is it possible to get a reference from a Result (or any other wrapper really) of an owned value?
For example, this is an error:
let foo = Ok(String::from("foo")); let foo_ref = foo.map(|s| &s);
The use case is I want to chain a bunch of calls together via
and_then, and I can’t pass around an owned value because then it will be dropped prematurely in the case of returning an error
At least I think… haven’t thought it through 100% but playing around with some of this hasn’t brought me to a solution yet. Will followup Sunday most likely