aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_vec.rs
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-08-19 17:37:22 -0700
committerRoy Frostig <[email protected]>2010-08-19 17:37:22 -0700
commit4a7aa75b5df2dba14ee03fb3a4d87a33ec0fd6dd (patch)
treee32837f9692a47d4415d8bd80e8f53aaa64d781d /src/lib/_vec.rs
parentExport all item code to stabs on Windows (including e.g. object methods) (diff)
downloadrust-4a7aa75b5df2dba14ee03fb3a4d87a33ec0fd6dd.tar.xz
rust-4a7aa75b5df2dba14ee03fb3a4d87a33ec0fd6dd.zip
Make _io.buf_reader read more than 0 bytes at a time.
Diffstat (limited to 'src/lib/_vec.rs')
-rw-r--r--src/lib/_vec.rs24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
index 509737d5..5f1d2baa 100644
--- a/src/lib/_vec.rs
+++ b/src/lib/_vec.rs
@@ -3,13 +3,25 @@ import op = util.operator;
native "rust" mod rustrt {
type vbuf;
+
fn vec_buf[T](vec[T] v, uint offset) -> vbuf;
+
fn vec_len[T](vec[T] v) -> uint;
- /* The T in vec_alloc[T, U] is the type of the vec to allocate. The
+ /**
+ * Sometimes we modify the vec internal data via vec_buf and need to update
+ * the vec's fill length accordingly.
+ */
+ fn vec_len_set[T](vec[T] v, uint n);
+
+ /**
+ * The T in vec_alloc[T, U] is the type of the vec to allocate. The
* U is the type of an element in the vec. So to allocate a vec[U] we
- * want to invoke this as vec_alloc[vec[U], U]. */
+ * want to invoke this as vec_alloc[vec[U], U].
+ */
fn vec_alloc[T, U](uint n_elts) -> vec[U];
+
fn refcount[T](vec[T] v) -> uint;
+
fn vec_print_debug_info[T](vec[T] v);
}
@@ -46,12 +58,16 @@ fn init_elt[T](&T t, uint n_elts) -> vec[T] {
ret v;
}
+fn buf[T](vec[T] v) -> vbuf {
+ ret rustrt.vec_buf[T](v, 0u);
+}
+
fn len[T](vec[T] v) -> uint {
ret rustrt.vec_len[T](v);
}
-fn buf[T](vec[T] v) -> vbuf {
- ret rustrt.vec_buf[T](v, 0u);
+fn len_set[T](vec[T] v, uint n) {
+ rustrt.vec_len_set[T](v, n);
}
fn buf_off[T](vec[T] v, uint offset) -> vbuf {