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.
Ohh, thanks! I'll give that a shot! - Have never used Cow before, so that's a fun excuse to actually try it :D Partly sad this isn't a better experience yet, but also a bit relieved I didn't miss something obvious haha.
-
-
Aw, struggling with implementing Cow properly for my own structs here. Not a simple fix either :(
-
You want to impl the API Cow gives you or use a Cow in your struct? You might also want to look at https://docs.rs/supercow if you need even more bovine power
- 2 more replies
New conversation -
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.