Think I just ran into a wart in Rust. Luckily I've got the time and enough experience at this point to know I'll be able to solve this, but others might not. Basically it's this: let foo = match bar { Some(bar) => bar, None => &make_bar()?, } where `bar` is borrowed.
Heh, well - the idea was to wrap my struct in a Cow so I can use it to return an owned version from the match statement. But that requires implementing a special `From` impl that feels a bit confusing. At this point I feel like a closure might be the least confusing option.
-
-
That said what are the use cases of using a cow?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.