From 1a8d609e89ed647204b68bfe40e83357644476cb Mon Sep 17 00:00:00 2001 From: Roy Frostig Date: Wed, 4 Aug 2010 12:59:48 -0700 Subject: Add a buffered writer to stdlib _io module. --- src/lib/_vec.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/lib/_vec.rs') 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. -- cgit v1.2.3