Skip to content

Commit dc7183e

Browse files
committed
core: rename MutableVector to OwnedVector
1 parent d1b7d44 commit dc7183e

File tree

3 files changed

+24
-25
lines changed

3 files changed

+24
-25
lines changed

src/libcore/core.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
191191
pub use str::{StrSlice, Trimmable};
192192
pub use vec::{ConstVector, CopyableVector, ImmutableVector};
193193
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
194-
pub use vec::{MutableVector, MutableCopyableVector};
194+
pub use vec::{OwnedVector, OwnedCopyableVector};
195195
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
196196
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
197197

src/libcore/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
2121
pub use str::{StrSlice, Trimmable};
2222
pub use vec::{ConstVector, CopyableVector, ImmutableVector};
2323
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
24-
pub use vec::{MutableVector, MutableCopyableVector};
24+
pub use vec::{OwnedVector, OwnedCopyableVector};
2525
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
2626
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
2727

src/libcore/vec.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,13 +1599,6 @@ pub trait ImmutableVector<T> {
15991599
pure fn filter_map<U: Copy>(f: fn(t: &T) -> Option<U>) -> ~[U];
16001600
}
16011601

1602-
pub trait ImmutableEqVector<T: Eq> {
1603-
pure fn position(f: fn(t: &T) -> bool) -> Option<uint>;
1604-
pure fn position_elem(t: &T) -> Option<uint>;
1605-
pure fn rposition(f: fn(t: &T) -> bool) -> Option<uint>;
1606-
pure fn rposition_elem(t: &T) -> Option<uint>;
1607-
}
1608-
16091602
/// Extension methods for vectors
16101603
impl<T> &[T]: ImmutableVector<T> {
16111604
/// Return a slice that points into another slice.
@@ -1671,6 +1664,13 @@ impl<T> &[T]: ImmutableVector<T> {
16711664
}
16721665
}
16731666

1667+
pub trait ImmutableEqVector<T: Eq> {
1668+
pure fn position(f: fn(t: &T) -> bool) -> Option<uint>;
1669+
pure fn position_elem(t: &T) -> Option<uint>;
1670+
pure fn rposition(f: fn(t: &T) -> bool) -> Option<uint>;
1671+
pure fn rposition_elem(t: &T) -> Option<uint>;
1672+
}
1673+
16741674
impl<T: Eq> &[T]: ImmutableEqVector<T> {
16751675
/**
16761676
* Find the first index matching some predicate
@@ -1740,7 +1740,7 @@ impl<T: Copy> &[T]: ImmutableCopyableVector<T> {
17401740
pure fn rfind(f: fn(t: &T) -> bool) -> Option<T> { rfind(self, f) }
17411741
}
17421742

1743-
pub trait MutableVector<T> {
1743+
pub trait OwnedVector<T> {
17441744
fn push(&mut self, t: T);
17451745
fn push_all_move(&mut self, rhs: ~[T]);
17461746
fn pop(&mut self) -> T;
@@ -1753,18 +1753,7 @@ pub trait MutableVector<T> {
17531753
fn retain(&mut self, f: pure fn(t: &T) -> bool);
17541754
}
17551755

1756-
pub trait MutableCopyableVector<T: Copy> {
1757-
fn push_all(&mut self, rhs: &[const T]);
1758-
fn grow(&mut self, n: uint, initval: &T);
1759-
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
1760-
fn grow_set(&mut self, index: uint, initval: &T, val: T);
1761-
}
1762-
1763-
trait MutableEqVector<T: Eq> {
1764-
fn dedup(&mut self);
1765-
}
1766-
1767-
impl<T> ~[T]: MutableVector<T> {
1756+
impl<T> ~[T]: OwnedVector<T> {
17681757
#[inline]
17691758
fn push(&mut self, t: T) {
17701759
push(self, t);
@@ -1817,7 +1806,14 @@ impl<T> ~[T]: MutableVector<T> {
18171806

18181807
}
18191808

1820-
impl<T: Copy> ~[T]: MutableCopyableVector<T> {
1809+
pub trait OwnedCopyableVector<T: Copy> {
1810+
fn push_all(&mut self, rhs: &[const T]);
1811+
fn grow(&mut self, n: uint, initval: &T);
1812+
fn grow_fn(&mut self, n: uint, op: iter::InitOp<T>);
1813+
fn grow_set(&mut self, index: uint, initval: &T, val: T);
1814+
}
1815+
1816+
impl<T: Copy> ~[T]: OwnedCopyableVector<T> {
18211817
#[inline]
18221818
fn push_all(&mut self, rhs: &[const T]) {
18231819
push_all(self, rhs);
@@ -1839,14 +1835,17 @@ impl<T: Copy> ~[T]: MutableCopyableVector<T> {
18391835
}
18401836
}
18411837

1842-
impl<T: Eq> ~[T]: MutableEqVector<T> {
1838+
trait OwnedEqVector<T: Eq> {
1839+
fn dedup(&mut self);
1840+
}
1841+
1842+
impl<T: Eq> ~[T]: OwnedEqVector<T> {
18431843
#[inline]
18441844
fn dedup(&mut self) {
18451845
dedup(self)
18461846
}
18471847
}
18481848

1849-
18501849
/**
18511850
* Constructs a vector from an unsafe pointer to a buffer
18521851
*

0 commit comments

Comments
 (0)