about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJeff Olson <olson.jeffery@gmail.com>2013-09-20 13:52:37 -0700
committerJeff Olson <olson.jeffery@gmail.com>2013-09-21 14:15:58 -0700
commit6ebb364d80b98397e7f83c97fcd3e9656dd4c470 (patch)
tree9ea5906797a07c7fe0481989619a00a3d83e3a01
parent44dc3fba8b10e066056a03f5444729d2e38596dc (diff)
downloadrust-6ebb364d80b98397e7f83c97fcd3e9656dd4c470.tar.gz
rust-6ebb364d80b98397e7f83c97fcd3e9656dd4c470.zip
std: cleanup file::io rustdoc_ng output
-rw-r--r--src/libstd/rt/io/file.rs116
1 files changed, 49 insertions, 67 deletions
diff --git a/src/libstd/rt/io/file.rs b/src/libstd/rt/io/file.rs
index a884961fd1e..97791760247 100644
--- a/src/libstd/rt/io/file.rs
+++ b/src/libstd/rt/io/file.rs
@@ -479,25 +479,29 @@ pub trait FileSystemInfo {
 ///
 /// * Check if a file exists, reading from it if so
 ///
-///     use std;
-///     use std::path::Path;
-///     use std::rt::io::file::{FileInfo, FileReader};
-///
-///     let f = &Path("/some/file/path.txt");
-///     if f.exists() {
-///         let reader = f.open_reader(Open);
-///         let mut mem = [0u8, 8*64000];
-///         reader.read(mem);
-///         // ...
-///     }
+/// ~~~{.rust}
+/// use std;
+/// use std::path::Path;
+/// use std::rt::io::file::{FileInfo, FileReader};
+///
+/// let f = &Path("/some/file/path.txt");
+/// if f.exists() {
+///     let reader = f.open_reader(Open);
+///     let mut mem = [0u8, 8*64000];
+///     reader.read(mem);
+///     // ...
+/// }
+/// ~~~
 ///
 /// * Is the given path a file?
 ///
-///    let f = get_file_path_from_wherever();
-///    match f.is_file() {
-///        true => doing_something_with_a_file(f),
-///        _ => {}
-///    }
+/// ~~~{.rust}
+/// let f = get_file_path_from_wherever();
+/// match f.is_file() {
+///    true => doing_something_with_a_file(f),
+///    _ => {}
+/// }
+/// ~~~
 pub trait FileInfo : FileSystemInfo {
     /// Whether the underlying implemention (be it a file path,
     /// or something else) points at a "regular file" on the FS. Will return
@@ -572,27 +576,31 @@ impl FileInfo for Path { }
 ///
 /// * Check if a directory exists, `mkdir`'ing it if not
 ///
-///     use std;
-///     use std::path::Path;
-///     use std::rt::io::file::{DirectoryInfo};
+/// ~~~{.rust}
+/// use std;
+/// use std::path::Path;
+/// use std::rt::io::file::{DirectoryInfo};
 ///
-///     let dir = &Path("/some/dir");
-///     if !dir.exists() {
-///         dir.mkdir();
-///     }
+/// let dir = &Path("/some/dir");
+/// if !dir.exists() {
+///     dir.mkdir();
+/// }
+/// ~~~
 ///
 /// * Is the given path a directory? If so, iterate on its contents
 ///
-///     fn visit_dirs(dir: &Path, cb: &fn(&Path)) {
-///         if dir.is_dir() {
-///             let contents = dir.readdir();
-///             for entry in contents.iter() {
-///                 if entry.is_dir() { visit_dirs(entry, cb); }
-///                 else { cb(entry); }
-///             }
+/// ~~~{.rust}
+/// fn visit_dirs(dir: &Path, cb: &fn(&Path)) {
+///     if dir.is_dir() {
+///         let contents = dir.readdir();
+///         for entry in contents.iter() {
+///             if entry.is_dir() { visit_dirs(entry, cb); }
+///             else { cb(entry); }
 ///         }
-///         else { fail!("nope"); }
 ///     }
+///     else { fail!("nope"); }
+/// }
+/// ~~~
 trait DirectoryInfo : FileSystemInfo {
     /// Whether the underlying implemention (be it a file path,
     /// or something else) is pointing at a directory in the underlying FS.
@@ -678,7 +686,8 @@ trait DirectoryInfo : FileSystemInfo {
 /// `DirectoryInfo` impl for `path::Path`
 impl DirectoryInfo for Path { }
 
-fn file_test_smoke_test_impl() {
+#[test]
+fn file_test_io_smoke_test() {
     do run_in_mt_newsched_task {
         let message = "it's alright. have a good time";
         let filename = &Path("./tmp/file_rt_io_file_test.txt");
@@ -701,11 +710,7 @@ fn file_test_smoke_test_impl() {
 }
 
 #[test]
-fn file_test_io_smoke_test() {
-    file_test_smoke_test_impl();
-}
-
-fn file_test_invalid_path_opened_without_create_should_raise_condition_impl() {
+fn file_test_io_invalid_path_opened_without_create_should_raise_condition() {
     do run_in_mt_newsched_task {
         let filename = &Path("./tmp/file_that_does_not_exist.txt");
         let mut called = false;
@@ -718,12 +723,9 @@ fn file_test_invalid_path_opened_without_create_should_raise_condition_impl() {
         assert!(called);
     }
 }
-#[test]
-fn file_test_io_invalid_path_opened_without_create_should_raise_condition() {
-    file_test_invalid_path_opened_without_create_should_raise_condition_impl();
-}
 
-fn file_test_unlinking_invalid_path_should_raise_condition_impl() {
+#[test]
+fn file_test_iounlinking_invalid_path_should_raise_condition() {
     do run_in_mt_newsched_task {
         let filename = &Path("./tmp/file_another_file_that_does_not_exist.txt");
         let mut called = false;
@@ -735,12 +737,9 @@ fn file_test_unlinking_invalid_path_should_raise_condition_impl() {
         assert!(called);
     }
 }
-#[test]
-fn file_test_iounlinking_invalid_path_should_raise_condition() {
-    file_test_unlinking_invalid_path_should_raise_condition_impl();
-}
 
-fn file_test_io_non_positional_read_impl() {
+#[test]
+fn file_test_io_non_positional_read() {
     do run_in_mt_newsched_task {
         use str;
         let message = "ten-four";
@@ -768,11 +767,7 @@ fn file_test_io_non_positional_read_impl() {
 }
 
 #[test]
-fn file_test_io_non_positional_read() {
-    file_test_io_non_positional_read_impl();
-}
-
-fn file_test_io_seeking_impl() {
+fn file_test_io_seek_and_tell_smoke_test() {
     do run_in_mt_newsched_task {
         use str;
         let message = "ten-four";
@@ -801,11 +796,7 @@ fn file_test_io_seeking_impl() {
 }
 
 #[test]
-fn file_test_io_seek_and_tell_smoke_test() {
-    file_test_io_seeking_impl();
-}
-
-fn file_test_io_seek_and_write_impl() {
+fn file_test_io_seek_and_write() {
     do run_in_mt_newsched_task {
         use str;
         let initial_msg =   "food-is-yummy";
@@ -831,11 +822,7 @@ fn file_test_io_seek_and_write_impl() {
 }
 
 #[test]
-fn file_test_io_seek_and_write() {
-    file_test_io_seek_and_write_impl();
-}
-
-fn file_test_io_seek_shakedown_impl() {
+fn file_test_io_seek_shakedown() {
     do run_in_mt_newsched_task {
         use str;          // 01234567890123
         let initial_msg =   "qwer-asdf-zxcv";
@@ -871,11 +858,6 @@ fn file_test_io_seek_shakedown_impl() {
 }
 
 #[test]
-fn file_test_io_seek_shakedown() {
-    file_test_io_seek_shakedown_impl();
-}
-
-#[test]
 fn file_test_stat_is_correct_on_is_file() {
     do run_in_mt_newsched_task {
         let filename = &Path("./tmp/file_stat_correct_on_is_file.txt");