Skip to content

Commit

Permalink
auto merge of #18559 : aturon/rust/prelude_cleanup, r=alexcrichton
Browse files Browse the repository at this point in the history
This commit renames a number of extension traits for slices and string slices, now that they have been refactored for DST. In many cases, multiple extension traits could now be consolidated. Further consolidation will be possible with generalized where clauses.

The renamings are consistent with the [new `-Prelude` suffix](rust-lang/rfcs#344). There are probably a few more candidates for being renamed this way, but that is left for API stabilization of the relevant modules.

Because this renames traits, it is a:

[breaking-change]

However, I do not expect any code that currently uses the standard library to actually break.

Closes #17917
  • Loading branch information
bors committed Nov 6, 2014
2 parents b081f63 + aa2155b commit 523a96c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions maybe_owned_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::default::Default;
use std::fmt;
use std::iter::FromIterator;
use std::path::BytesContainer;
use std::slice;
use std::slice::{mod, Permutations};

// Note 1: It is not clear whether the flexibility of providing both
// the `Growable` and `FixedLen` variants is sufficiently useful.
Expand Down Expand Up @@ -137,11 +137,19 @@ impl<'a,T:fmt::Show> fmt::Show for MaybeOwnedVector<'a,T> {
}
}

impl<'a,T:Clone> CloneableVector<T> for MaybeOwnedVector<'a,T> {
impl<'a,T:Clone> CloneSliceAllocPrelude<T> for MaybeOwnedVector<'a,T> {
/// Returns a copy of `self`.
fn to_vec(&self) -> Vec<T> {
self.as_slice().to_vec()
}

fn partitioned(&self, f: |&T| -> bool) -> (Vec<T>, Vec<T>) {
self.as_slice().partitioned(f)
}

fn permutations(&self) -> Permutations<T> {
self.as_slice().permutations()
}
}

impl<'a, T: Clone> Clone for MaybeOwnedVector<'a, T> {
Expand All @@ -153,7 +161,6 @@ impl<'a, T: Clone> Clone for MaybeOwnedVector<'a, T> {
}
}


impl<'a, T> Default for MaybeOwnedVector<'a, T> {
fn default() -> MaybeOwnedVector<'a, T> {
Growable(Vec::new())
Expand Down

0 comments on commit 523a96c

Please sign in to comment.