- Feature Name: NA
- Start Date: 2015-04-03
- RFC PR: rust-lang/rfcs#1030
- Rust Issue: rust-lang/rust#24538
ToOwned trait to the prelude.
Each trait has a distinct motivation:
Default, the ergonomics have vastly improved now that you can write
MyType::default()(thanks to UFCS). Thanks to this improvement, it now makes more sense to promote widespread use of the trait.
IntoIterator, promoting to the prelude will make it feasible to deprecate the inherent
into_itermethods and directly-exported iterator types, in favor of the trait (which is currently redundant).
ToOwned, promoting to the prelude would add a uniform, idiomatic way to acquire an owned copy of data (including going from
String, for which
Clonedoes not work).
ToOwnedtrait to the prelude.
Ultimately deprecate module-level
IntoItertypes (e.g. in
vec); this may want to wait until you can write
<Vec<T> as IntoIterator>::IntoIter.
The main downside is that prelude entries eat up some amount of
namespace (particularly, method namespace). However, these are all
important, core traits in
std, meaning that the method names are
already quite unlikely to be used.
Strictly speaking, a prelude addition is a breaking change, but as above, this is highly unlikely to cause actual breakage. In any case, it can be landed prior to 1.0.
The exact timeline of deprecation for
Are there other traits or types that should be promoted before 1.0?