aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_str.rs
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-03-22 16:38:47 -0700
committerPatrick Walton <[email protected]>2011-03-22 16:40:22 -0700
commitb33f0df152fd2242a1ea88d0961065caecd228ac (patch)
treeeaf1ef79e516e842b1c16f2e955a2bfc3964740c /src/lib/_str.rs
parentChange the type of the second argument of upcalls to be a %task*. (diff)
downloadrust-b33f0df152fd2242a1ea88d0961065caecd228ac.tar.xz
rust-b33f0df152fd2242a1ea88d0961065caecd228ac.zip
stdlib: Make writers seekable; switch file writers to the C FILE interface to make this work
Diffstat (limited to 'src/lib/_str.rs')
-rw-r--r--src/lib/_str.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/_str.rs b/src/lib/_str.rs
index e73fd115..87eef514 100644
--- a/src/lib/_str.rs
+++ b/src/lib/_str.rs
@@ -7,7 +7,7 @@ native "rust" mod rustrt {
fn str_buf(str s) -> sbuf;
fn str_byte_len(str s) -> uint;
fn str_alloc(uint n_bytes) -> str;
- fn str_from_vec(vec[u8] b) -> str;
+ fn str_from_vec(vec[mutable? u8] b) -> str;
fn str_from_cstr(sbuf cstr) -> str;
fn str_from_buf(sbuf buf, uint len) -> str;
fn refcount[T](str s) -> uint;
@@ -109,7 +109,16 @@ fn from_bytes(vec[u8] v) : is_utf8(v) -> str {
}
// FIXME temp thing
-fn unsafe_from_bytes(vec[u8] v) -> str {
+fn unsafe_from_bytes(vec[mutable? u8] v) -> str {
+ ret rustrt.str_from_vec(v);
+}
+
+// FIXME even temp-er thing; rustc can use "unsafe_from_bytes" above
+fn unsafe_from_mutable_bytes(vec[mutable u8] mv) -> str {
+ let vec[u8] v = vec();
+ for (mutable u8 b in mv) {
+ v += vec(b);
+ }
ret rustrt.str_from_vec(v);
}