I have an iterator whose Items are Cow<'static, str>, and I'd love to convert that into a Vec<&'static str>. After searching through docs and experimenting for quite some time, I must admit defeat to my bovine adversary.
Just how does an honest farmer programmer borrow the contents of a Cow?
Realize that an owned string (String) can be stored in a Cow<'static, str>. An owned string is not&'static str, and the only way to do so would be explicitly leaking memory. Needless to say I do not recommend this.
You could get a Vec<'someshorterlifetime str> with iterator.map(|cow| cow.as_ref()).collect(), if the shorter lifetime fits your needs. (I see in the other thread you're battling some questionable APIs.)
Thanks guys, in the end I'm going to try and be less fancy and just yield Vec<String> after doing some more intermediate manipulations I didn't describe earlier. The Vec is short anyway, the allocations won't be the end of the world here.