about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-03-22 17:52:03 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-03-22 17:53:43 -0700
commitc1bc0101ca4a5e01a71ca0281d9e4f0b4803bba7 (patch)
tree4b66b8432340be7cc8fd662aadbd269055875cd6
parent23e23bd762a4b5a14ff2abcbabfd2349621a3dbe (diff)
downloadrust-c1bc0101ca4a5e01a71ca0281d9e4f0b4803bba7.tar.gz
rust-c1bc0101ca4a5e01a71ca0281d9e4f0b4803bba7.zip
stdlib: Provide a function to extract the underlying buf_writer from a writer
-rw-r--r--src/lib/io.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/io.rs b/src/lib/io.rs
index 80597ea275a..dea15a27a1d 100644
--- a/src/lib/io.rs
+++ b/src/lib/io.rs
@@ -223,6 +223,7 @@ fn file_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
 
 type writer =
     state obj {
+          fn get_buf_writer() -> buf_writer;
           impure fn write_str(str s);
           impure fn write_int(int n);
           impure fn write_uint(uint n);
@@ -242,6 +243,9 @@ fn uint_to_le_bytes(uint n, uint size) -> vec[u8] {
 }
 
 state obj new_writer(buf_writer out) {
+    fn get_buf_writer() -> buf_writer {
+        ret out;
+    }
     impure fn write_str(str s) {
         out.write(_str.bytes(s));
     }
@@ -262,6 +266,11 @@ state obj new_writer(buf_writer out) {
     }
 }
 
+// FIXME: Remove me once objects are exported.
+fn new_writer_(buf_writer out) -> writer {
+    ret new_writer(out);
+}
+
 fn file_writer(str path, vec[fileflag] flags) -> writer {
     ret new_writer(file_buf_writer(path, flags));
 }