about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-09-25 17:52:46 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-09-25 17:53:23 -0700
commitcac5a9f916c07c68f9e5ea361dfa6261d978995e (patch)
tree334e88b292f0eaf962629151f1d5bcf304d82953
parentd05e2ad66c7bb2418b7c746f87486d4f74180193 (diff)
libcore: De-export core::at_vec
-rw-r--r--src/libcore/at_vec.rs51
-rw-r--r--src/libcore/core.rc1
2 files changed, 21 insertions, 31 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs
index e35e6536410..fdd0e4fd47e 100644
--- a/src/libcore/at_vec.rs
+++ b/src/libcore/at_vec.rs
@@ -2,14 +2,6 @@
 
 use ptr::addr_of;
 
-export init_op;
-export capacity;
-export build_sized, build, build_sized_opt;
-export map;
-export from_fn, from_elem;
-export raw;
-export traits;
-
 /// Code for dealing with @-vectors. This is pretty incomplete, and
 /// contains a bunch of duplication from the code for ~-vectors.
 
@@ -29,7 +21,7 @@ extern mod rusti {
 
 /// Returns the number of elements the vector can hold without reallocating
 #[inline(always)]
-pure fn capacity<T>(&&v: @[const T]) -> uint {
+pub pure fn capacity<T>(&&v: @[const T]) -> uint {
     unsafe {
         let repr: **raw::VecRepr =
             ::cast::reinterpret_cast(&addr_of(v));
@@ -50,8 +42,8 @@ pure fn capacity<T>(&&v: @[const T]) -> uint {
  *             onto the vector being constructed.
  */
 #[inline(always)]
-pure fn build_sized<A>(size: uint,
-                       builder: fn(push: pure fn(+v: A))) -> @[A] {
+pub pure fn build_sized<A>(size: uint,
+                           builder: fn(push: pure fn(+v: A))) -> @[A] {
     let mut vec = @[];
     unsafe { raw::reserve(vec, size); }
     builder(|+x| unsafe { raw::push(vec, move x) });
@@ -69,7 +61,7 @@ pure fn build_sized<A>(size: uint,
  *             onto the vector being constructed.
  */
 #[inline(always)]
-pure fn build<A>(builder: fn(push: pure fn(+v: A))) -> @[A] {
+pub pure fn build<A>(builder: fn(push: pure fn(+v: A))) -> @[A] {
     build_sized(4, builder)
 }
 
@@ -86,14 +78,14 @@ pure fn build<A>(builder: fn(push: pure fn(+v: A))) -> @[A] {
  *             onto the vector being constructed.
  */
 #[inline(always)]
-pure fn build_sized_opt<A>(size: Option<uint>,
+pub pure fn build_sized_opt<A>(size: Option<uint>,
                            builder: fn(push: pure fn(+v: A))) -> @[A] {
     build_sized(size.get_default(4), builder)
 }
 
 // Appending
 #[inline(always)]
-pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
+pub pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
     do build_sized(lhs.len() + rhs.len()) |push| {
         for vec::each(lhs) |x| { push(*x); }
         for uint::range(0, rhs.len()) |i| { push(rhs[i]); }
@@ -102,7 +94,7 @@ pure fn append<T: Copy>(lhs: @[T], rhs: &[const T]) -> @[T] {
 
 
 /// Apply a function to each element of a vector and return the results
-pure fn map<T, U>(v: &[T], f: fn(T) -> U) -> @[U] {
+pub pure fn map<T, U>(v: &[T], f: fn(T) -> U) -> @[U] {
     do build_sized(v.len()) |push| {
         for vec::each(v) |elem| {
             push(f(*elem));
@@ -116,7 +108,7 @@ pure fn map<T, U>(v: &[T], f: fn(T) -> U) -> @[U] {
  * Creates an immutable vector of size `n_elts` and initializes the elements
  * to the value returned by the function `op`.
  */
-pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
+pub pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
     do build_sized(n_elts) |push| {
         let mut i: uint = 0u;
         while i < n_elts { push(op(i)); i += 1u; }
@@ -129,7 +121,7 @@ pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> @[T] {
  * Creates an immutable vector of size `n_elts` and initializes the elements
  * to the value `t`.
  */
-pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
+pub pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> @[T] {
     do build_sized(n_elts) |push| {
         let mut i: uint = 0u;
         while i < n_elts { push(t); i += 1u; }
@@ -148,13 +140,12 @@ mod traits {
 }
 
 #[cfg(test)]
-mod traits {
+pub mod traits {
     #[legacy_exports];}
 
-mod raw {
-    #[legacy_exports];
-    type VecRepr = vec::raw::VecRepr;
-    type SliceRepr = vec::raw::SliceRepr;
+pub mod raw {
+    pub type VecRepr = vec::raw::VecRepr;
+    pub type SliceRepr = vec::raw::SliceRepr;
 
     /**
      * Sets the length of a vector
@@ -164,13 +155,13 @@ mod raw {
      * the vector is actually the specified size.
      */
     #[inline(always)]
-    unsafe fn set_len<T>(&&v: @[const T], new_len: uint) {
+    pub unsafe fn set_len<T>(&&v: @[const T], new_len: uint) {
         let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
         (**repr).unboxed.fill = new_len * sys::size_of::<T>();
     }
 
     #[inline(always)]
-    unsafe fn push<T>(&v: @[const T], +initval: T) {
+    pub unsafe fn push<T>(&v: @[const T], +initval: T) {
         let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
         let fill = (**repr).unboxed.fill;
         if (**repr).unboxed.alloc > fill {
@@ -182,7 +173,7 @@ mod raw {
     }
     // This doesn't bother to make sure we have space.
     #[inline(always)] // really pretty please
-    unsafe fn push_fast<T>(&v: @[const T], +initval: T) {
+    pub unsafe fn push_fast<T>(&v: @[const T], +initval: T) {
         let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
         let fill = (**repr).unboxed.fill;
         (**repr).unboxed.fill += sys::size_of::<T>();
@@ -191,7 +182,7 @@ mod raw {
         rusti::move_val_init(*p, move initval);
     }
 
-    unsafe fn push_slow<T>(&v: @[const T], +initval: T) {
+    pub unsafe fn push_slow<T>(&v: @[const T], +initval: T) {
         reserve_at_least(v, v.len() + 1u);
         push_fast(v, move initval);
     }
@@ -207,7 +198,7 @@ mod raw {
      * * v - A vector
      * * n - The number of elements to reserve space for
      */
-    unsafe fn reserve<T>(&v: @[const T], n: uint) {
+    pub unsafe fn reserve<T>(&v: @[const T], n: uint) {
         // Only make the (slow) call into the runtime if we have to
         if capacity(v) < n {
             let ptr = addr_of(v) as **VecRepr;
@@ -231,14 +222,14 @@ mod raw {
      * * v - A vector
      * * n - The number of elements to reserve space for
      */
-    unsafe fn reserve_at_least<T>(&v: @[const T], n: uint) {
+    pub unsafe fn reserve_at_least<T>(&v: @[const T], n: uint) {
         reserve(v, uint::next_power_of_two(n));
     }
 
 }
 
 #[test]
-fn test() {
+pub fn test() {
     // Some code that could use that, then:
     fn seq_range(lo: uint, hi: uint) -> @[uint] {
         do build |push| {
@@ -254,7 +245,7 @@ fn test() {
 }
 
 #[test]
-fn append_test() {
+pub fn append_test() {
     assert @[1,2,3] + @[4,5,6] == @[1,2,3,4,5,6];
 }
 
diff --git a/src/libcore/core.rc b/src/libcore/core.rc
index 9568294c7ba..e82c16b1f04 100644
--- a/src/libcore/core.rc
+++ b/src/libcore/core.rc
@@ -201,7 +201,6 @@ mod str;
 mod ptr;
 #[legacy_exports]
 mod vec;
-#[legacy_exports]
 mod at_vec;
 #[legacy_exports]
 mod bool;