summary refs log tree commit diff
path: root/src/libstd/c_vec.rs
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-03-13 14:39:28 -0700
committerBrian Anderson <banderson@mozilla.com>2012-03-13 15:14:17 -0700
commitb968c8e6cd362567bf0047a96d261691dfca43e8 (patch)
tree9cec3e42976bef8815df2a5710083d2bb518b651 /src/libstd/c_vec.rs
parenta38ccf12547b1bdb37dce3c7edca5b95a898326a (diff)
downloadrust-b968c8e6cd362567bf0047a96d261691dfca43e8.tar.gz
rust-b968c8e6cd362567bf0047a96d261691dfca43e8.zip
Name types after their modules instead of 't'
Diffstat (limited to 'src/libstd/c_vec.rs')
-rw-r--r--src/libstd/c_vec.rs42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index 532f2903af3..28ee44690ee 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -25,7 +25,7 @@ form -- for instance, to pass memory back into C -- but great care must be
 taken to ensure that a reference to the c_vec::t is still held if needed.
 "];
 
-export t;
+export c_vec;
 export c_vec, c_vec_with_dtor;
 export get, set;
 export len;
@@ -37,8 +37,8 @@ The type representing a native 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 t<T> {
-    t({ base: *mutable T, len: uint, rsrc: @dtor_res})
+enum c_vec<T> {
+    c_vec_({ base: *mutable T, len: uint, rsrc: @dtor_res})
 }
 
 resource dtor_res(dtor: option<fn@()>) {
@@ -53,22 +53,23 @@ resource dtor_res(dtor: option<fn@()>) {
  */
 
 #[doc = "
-Create a c_vec::t from a native buffer with a given length.
+Create a `c_vec` from a native buffer with a given length.
 
 # Arguments
 
 * base - A native pointer to a buffer
 * len - The number of elements in the buffer
 "]
-unsafe fn c_vec<T>(base: *mutable T, len: uint) -> t<T> {
-    ret t({base: base,
-           len: len,
-           rsrc: @dtor_res(option::none)
-          });
+unsafe fn c_vec<T>(base: *mutable T, len: uint) -> c_vec<T> {
+    ret c_vec_({
+        base: base,
+        len: len,
+        rsrc: @dtor_res(option::none)
+    });
 }
 
 #[doc = "
-Create a c_vec::t from a native buffer, with a given length,
+Create a `c_vec` from a native buffer, with a given length,
 and a function to run upon destruction.
 
 # Arguments
@@ -79,11 +80,12 @@ and a function to run upon destruction.
          for freeing the buffer, etc.
 "]
 unsafe fn c_vec_with_dtor<T>(base: *mutable T, len: uint, dtor: fn@())
-  -> t<T> {
-    ret t({base: base,
-           len: len,
-           rsrc: @dtor_res(option::some(dtor))
-          });
+  -> c_vec<T> {
+    ret c_vec_({
+        base: base,
+        len: len,
+        rsrc: @dtor_res(option::some(dtor))
+    });
 }
 
 /*
@@ -95,7 +97,7 @@ Retrieves an element at a given index
 
 Fails if `ofs` is greater or equal to the length of the vector
 "]
-fn get<T: copy>(t: t<T>, ofs: uint) -> T {
+fn get<T: copy>(t: c_vec<T>, ofs: uint) -> T {
     assert ofs < len(t);
     ret unsafe { *ptr::mut_offset((*t).base, ofs) };
 }
@@ -105,7 +107,7 @@ Sets the value of an element at a given index
 
 Fails if `ofs` is greater or equal to the length of the vector
 "]
-fn set<T: copy>(t: t<T>, ofs: uint, v: T) {
+fn set<T: copy>(t: c_vec<T>, ofs: uint, v: T) {
     assert ofs < len(t);
     unsafe { *ptr::mut_offset((*t).base, ofs) = v };
 }
@@ -115,12 +117,12 @@ fn set<T: copy>(t: t<T>, ofs: uint, v: T) {
  */
 
 #[doc = "Returns the length of the vector"]
-fn len<T>(t: t<T>) -> uint {
+fn len<T>(t: c_vec<T>) -> uint {
     ret (*t).len;
 }
 
 #[doc = "Returns a pointer to the first element of the vector"]
-unsafe fn ptr<T>(t: t<T>) -> *mutable T {
+unsafe fn ptr<T>(t: c_vec<T>) -> *mutable T {
     ret (*t).base;
 }
 
@@ -128,7 +130,7 @@ unsafe fn ptr<T>(t: t<T>) -> *mutable T {
 mod tests {
     import libc::*;
 
-    fn malloc(n: size_t) -> t<u8> {
+    fn malloc(n: size_t) -> c_vec<u8> {
         let mem = libc::malloc(n);
 
         assert mem as int != 0;