Question: Cow<Option<T>> vs Option<Cow<T>> , when to use which?

44 points fatman859

Hi,

I have a trait/interface with member functions that return Option<T>. I want to be able to return an Option<T> or an a reference to it (&Option<T>) so that there are no unnecessary clones so I am using Cow for it. The question I've stumbled upon is, is essentially, is it better to return Option<T> and &Option<T> or Option<T> and Option<&T>. I'm assuming this extends to the use of Cow in this case. please correct me if I'm wrong here.

Which is preferred when and why?