summary refs log tree commit diff
path: root/src/libcore/vec.rs
diff options
context:
space:
mode:
authorTrinick <slicksilver555@mac.com>2013-01-23 01:22:44 +0000
committerTrinick <slicksilver555@mac.com>2013-01-23 10:09:45 +0000
commit9dc8e96c5fac7812039bf6ddf640dcbb77f1a2f0 (patch)
tree916cbaa3fbe00793405ea6abbcaa28d44330e702 /src/libcore/vec.rs
parent93e969e356dc8908a7eeef675269149f81a10eed (diff)
core: Rename to_mut and from_mut to cast_to_mut and cast_from_mut
Diffstat (limited to 'src/libcore/vec.rs')
-rw-r--r--src/libcore/vec.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs
index 8b8a4f5a18a..23dc2a4781a 100644
--- a/src/libcore/vec.rs
+++ b/src/libcore/vec.rs
@@ -209,12 +209,12 @@ pub pure fn build_sized_opt<A>(size: Option<uint>,
 }
 
 /// Produces a mut vector from an immutable vector.
-pub pure fn to_mut<T>(v: ~[T]) -> ~[mut T] {
+pub pure fn cast_to_mut<T>(v: ~[T]) -> ~[mut T] {
     unsafe { ::cast::transmute(v) }
 }
 
 /// Produces an immutable vector from a mut vector.
-pub pure fn from_mut<T>(v: ~[mut T]) -> ~[T] {
+pub pure fn cast_from_mut<T>(v: ~[mut T]) -> ~[T] {
     unsafe { ::cast::transmute(v) }
 }
 
@@ -552,7 +552,7 @@ pub fn consume<T>(v: ~[T], f: fn(uint, v: T)) unsafe {
 }
 
 pub fn consume_mut<T>(v: ~[mut T], f: fn(uint, v: T)) {
-    consume(vec::from_mut(v), f)
+    consume(vec::cast_from_mut(v), f)
 }
 
 /// Remove the last element from a vector and return it
@@ -718,7 +718,7 @@ pub pure fn append_one<T>(lhs: ~[T], x: T) -> ~[T] {
 
 #[inline(always)]
 pub pure fn append_mut<T: Copy>(lhs: ~[mut T], rhs: &[const T]) -> ~[mut T] {
-    to_mut(append(from_mut(lhs), rhs))
+    cast_to_mut(append(cast_from_mut(lhs), rhs))
 }
 
 /**
@@ -3271,22 +3271,22 @@ mod tests {
     }
 
     #[test]
-    fn to_mut_no_copy() {
+    fn cast_to_mut_no_copy() {
         unsafe {
             let x = ~[1, 2, 3];
             let addr = raw::to_ptr(x);
-            let x_mut = to_mut(x);
+            let x_mut = cast_to_mut(x);
             let addr_mut = raw::to_ptr(x_mut);
             assert addr == addr_mut;
         }
     }
 
     #[test]
-    fn from_mut_no_copy() {
+    fn cast_from_mut_no_copy() {
         unsafe {
             let x = ~[mut 1, 2, 3];
             let addr = raw::to_ptr(x);
-            let x_imm = from_mut(x);
+            let x_imm = cast_from_mut(x);
             let addr_imm = raw::to_ptr(x_imm);
             assert addr == addr_imm;
         }