aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-06 13:51:42 -0500
committerGraydon Hoare <[email protected]>2011-03-06 15:13:30 -0800
commitbed457d3a7244b317c54962d80b460294b846c27 (patch)
tree8a258657af739e455733bc3cc5161033a37355a9 /src/lib
parentMake _str.bytes use _vec.init_fn. Remove FIXME. (diff)
downloadrust-bed457d3a7244b317c54962d80b460294b846c27.tar.xz
rust-bed457d3a7244b317c54962d80b460294b846c27.zip
Change io.fileflag to a tag type. Remove FIXME
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/io.rs27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/lib/io.rs b/src/lib/io.rs
index f285f6c8..9f428cee 100644
--- a/src/lib/io.rs
+++ b/src/lib/io.rs
@@ -85,18 +85,11 @@ fn new_buf_reader(str path) -> buf_reader {
ret fd_buf_reader(fd, new_buf());
}
-/**
- * FIXME (issue #150): This should be
- *
- * type fileflag = tag(append(), create(), truncate());
- *
- * but then the tag value ctors are not found from crate-importers of std, so
- * we manually simulate the enum below.
- */
-type fileflag = uint;
-fn append() -> uint { ret 0u; }
-fn create() -> uint { ret 1u; }
-fn truncate() -> uint { ret 2u; }
+tag fileflag {
+ append;
+ create;
+ truncate;
+}
fn new_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
@@ -129,13 +122,9 @@ fn new_buf_writer(str path, vec[fileflag] flags) -> buf_writer {
for (fileflag f in flags) {
alt (f) {
- // FIXME (issue #150): cf comment above defn of fileflag type
- //case (append()) { fflags |= os.libc_constants.O_APPEND(); }
- //case (create()) { fflags |= os.libc_constants.O_CREAT(); }
- //case (truncate()) { fflags |= os.libc_constants.O_TRUNC(); }
- case (0u) { fflags |= os.libc_constants.O_APPEND(); }
- case (1u) { fflags |= os.libc_constants.O_CREAT(); }
- case (2u) { fflags |= os.libc_constants.O_TRUNC(); }
+ case (append) { fflags |= os.libc_constants.O_APPEND(); }
+ case (create) { fflags |= os.libc_constants.O_CREAT(); }
+ case (truncate) { fflags |= os.libc_constants.O_TRUNC(); }
}
}