diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index f4df063a93d..1ff5b63ee12 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -26,19 +26,13 @@ * still held if needed. */ -export CVec; -export CVec, c_vec_with_dtor; -export get, set; -export len; -export ptr; - /** * The type representing a foreign chunk of memory * * Wrapped in a enum for opacity; FIXME #818 when it is possible to have * truly opaque types, this should be revisited. */ -enum CVec { +pub enum CVec { CVecCtor({ base: *mut T, len: uint, rsrc: @DtorRes}) } @@ -70,7 +64,7 @@ fn DtorRes(dtor: Option) -> DtorRes { * * base - A foreign pointer to a buffer * * len - The number of elements in the buffer */ -unsafe fn CVec(base: *mut T, len: uint) -> CVec { +pub unsafe fn CVec(base: *mut T, len: uint) -> CVec { return CVecCtor({ base: base, len: len, @@ -89,7 +83,7 @@ unsafe fn CVec(base: *mut T, len: uint) -> CVec { * * dtor - A function to run when the value is destructed, useful * for freeing the buffer, etc. */ -unsafe fn c_vec_with_dtor(base: *mut T, len: uint, dtor: fn@()) +pub unsafe fn c_vec_with_dtor(base: *mut T, len: uint, dtor: fn@()) -> CVec { return CVecCtor({ base: base, @@ -107,7 +101,7 @@ unsafe fn c_vec_with_dtor(base: *mut T, len: uint, dtor: fn@()) * * Fails if `ofs` is greater or equal to the length of the vector */ -fn get(t: CVec, ofs: uint) -> T { +pub fn get(t: CVec, ofs: uint) -> T { assert ofs < len(t); return unsafe { *ptr::mut_offset((*t).base, ofs) }; } @@ -117,7 +111,7 @@ fn get(t: CVec, ofs: uint) -> T { * * Fails if `ofs` is greater or equal to the length of the vector */ -fn set(t: CVec, ofs: uint, +v: T) { +pub fn set(t: CVec, ofs: uint, +v: T) { assert ofs < len(t); unsafe { *ptr::mut_offset((*t).base, ofs) = v }; } @@ -127,18 +121,17 @@ fn set(t: CVec, ofs: uint, +v: T) { */ /// Returns the length of the vector -fn len(t: CVec) -> uint { +pub fn len(t: CVec) -> uint { return (*t).len; } /// Returns a pointer to the first element of the vector -unsafe fn ptr(t: CVec) -> *mut T { +pub unsafe fn ptr(t: CVec) -> *mut T { return (*t).base; } #[cfg(test)] mod tests { - #[legacy_exports]; use libc::*; fn malloc(n: size_t) -> CVec { diff --git a/src/libstd/std.rc b/src/libstd/std.rc index 27b9dfac2bb..5b181d2e4c0 100644 --- a/src/libstd/std.rc +++ b/src/libstd/std.rc @@ -67,7 +67,6 @@ mod uv_global_loop; // Utility modules -#[legacy_exports] mod c_vec; mod timer; mod cell;