maciejhirsz / beef

Faster, more compact implementation of std::borrow::Cow
https://crates.io/crates/beef
Apache License 2.0
338 stars 17 forks source link

a way to 'extract' the borrowed value #19

Closed Licenser closed 4 years ago

Licenser commented 4 years ago

In a few places I'm using code like

match cow of {
  Cow::Owned(o) -> // do something with the owned thingy
  Cow::Borrowed(b) -> // do something with the borrowed thingy (keeping it's lifetime)
}

I can't find a way to do that in beef Is there a chance to get a function along the lines of:

fn a_good_name_for_this(self) -> Option<&'a T> {
...
}