diff options
| author | Tohava <tohava@tohava-laptop.(none)> | 2010-08-05 04:19:46 +0300 |
|---|---|---|
| committer | Tohava <tohava@tohava-laptop.(none)> | 2010-08-05 04:19:46 +0300 |
| commit | ce79b0e492f1583debbce3c8155da3536c684d9a (patch) | |
| tree | f5a2a22230510dd14901742a4904c576f62a8500 /src/lib/_vec.rs | |
| parent | Added AST logging, and modified AST for consistent handling of alt stmts. (diff) | |
| parent | Thread argument-types down to internal_check_outer_lval in type.ml, in prepar... (diff) | |
| download | rust-ce79b0e492f1583debbce3c8155da3536c684d9a.tar.xz rust-ce79b0e492f1583debbce3c8155da3536c684d9a.zip | |
Merge branch 'master' of git://github.com/graydon/rust
Diffstat (limited to 'src/lib/_vec.rs')
| -rw-r--r-- | src/lib/_vec.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs index 43779015..e374bf52 100644 --- a/src/lib/_vec.rs +++ b/src/lib/_vec.rs @@ -3,7 +3,7 @@ import op = util.operator; native "rust" mod rustrt { type vbuf; - fn vec_buf[T](vec[T] v) -> 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 * U is the type of an element in the vec. So to allocate a vec[U] we @@ -50,7 +50,12 @@ fn len[T](vec[T] v) -> uint { } fn buf[T](vec[T] v) -> vbuf { - ret rustrt.vec_buf[T](v); + ret rustrt.vec_buf[T](v, 0u); +} + +fn buf_off[T](vec[T] v, uint offset) -> vbuf { + check (offset < len[T](v)); + ret rustrt.vec_buf[T](v, offset); } // Returns elements from [start..end) from v. |