It is a pain to go from Option<String> to Option<&str>:
opt.as_ref().map(|s| s.as_slice())
This could be improved by integrating the new BorrowFrom infrastructure, generalizing the signature of as_ref from
fn as_ref(&self) -> Option<&T>
to
fn as_ref<U=T>(&self) -> Option<&U> where U: BorrowFrom<T>
However, to avoid a regression in type inference for types that can be borrowed in multiple ways, we need default type parameters on methods (as above). See rust-lang/rfcs#213
It is a pain to go from
Option<String>toOption<&str>:This could be improved by integrating the new
BorrowFrominfrastructure, generalizing the signature ofas_reffromto
However, to avoid a regression in type inference for types that can be borrowed in multiple ways, we need default type parameters on methods (as above). See rust-lang/rfcs#213