std: cleanup file::io rustdoc_ng output
This commit is contained in:
parent
44dc3fba8b
commit
6ebb364d80
|
@ -479,25 +479,29 @@ pub trait FileSystemInfo {
|
||||||
///
|
///
|
||||||
/// * Check if a file exists, reading from it if so
|
/// * Check if a file exists, reading from it if so
|
||||||
///
|
///
|
||||||
/// use std;
|
/// ~~~{.rust}
|
||||||
/// use std::path::Path;
|
/// use std;
|
||||||
/// use std::rt::io::file::{FileInfo, FileReader};
|
/// use std::path::Path;
|
||||||
|
/// use std::rt::io::file::{FileInfo, FileReader};
|
||||||
///
|
///
|
||||||
/// let f = &Path("/some/file/path.txt");
|
/// let f = &Path("/some/file/path.txt");
|
||||||
/// if f.exists() {
|
/// if f.exists() {
|
||||||
/// let reader = f.open_reader(Open);
|
/// let reader = f.open_reader(Open);
|
||||||
/// let mut mem = [0u8, 8*64000];
|
/// let mut mem = [0u8, 8*64000];
|
||||||
/// reader.read(mem);
|
/// reader.read(mem);
|
||||||
/// // ...
|
/// // ...
|
||||||
/// }
|
/// }
|
||||||
|
/// ~~~
|
||||||
///
|
///
|
||||||
/// * Is the given path a file?
|
/// * Is the given path a file?
|
||||||
///
|
///
|
||||||
/// let f = get_file_path_from_wherever();
|
/// ~~~{.rust}
|
||||||
/// match f.is_file() {
|
/// let f = get_file_path_from_wherever();
|
||||||
/// true => doing_something_with_a_file(f),
|
/// match f.is_file() {
|
||||||
/// _ => {}
|
/// true => doing_something_with_a_file(f),
|
||||||
/// }
|
/// _ => {}
|
||||||
|
/// }
|
||||||
|
/// ~~~
|
||||||
pub trait FileInfo : FileSystemInfo {
|
pub trait FileInfo : FileSystemInfo {
|
||||||
/// Whether the underlying implemention (be it a file path,
|
/// Whether the underlying implemention (be it a file path,
|
||||||
/// or something else) points at a "regular file" on the FS. Will return
|
/// 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
|
/// * Check if a directory exists, `mkdir`'ing it if not
|
||||||
///
|
///
|
||||||
/// use std;
|
/// ~~~{.rust}
|
||||||
/// use std::path::Path;
|
/// use std;
|
||||||
/// use std::rt::io::file::{DirectoryInfo};
|
/// use std::path::Path;
|
||||||
|
/// use std::rt::io::file::{DirectoryInfo};
|
||||||
///
|
///
|
||||||
/// let dir = &Path("/some/dir");
|
/// let dir = &Path("/some/dir");
|
||||||
/// if !dir.exists() {
|
/// if !dir.exists() {
|
||||||
/// dir.mkdir();
|
/// dir.mkdir();
|
||||||
/// }
|
/// }
|
||||||
|
/// ~~~
|
||||||
///
|
///
|
||||||
/// * Is the given path a directory? If so, iterate on its contents
|
/// * Is the given path a directory? If so, iterate on its contents
|
||||||
///
|
///
|
||||||
/// fn visit_dirs(dir: &Path, cb: &fn(&Path)) {
|
/// ~~~{.rust}
|
||||||
/// if dir.is_dir() {
|
/// fn visit_dirs(dir: &Path, cb: &fn(&Path)) {
|
||||||
/// let contents = dir.readdir();
|
/// if dir.is_dir() {
|
||||||
/// for entry in contents.iter() {
|
/// let contents = dir.readdir();
|
||||||
/// if entry.is_dir() { visit_dirs(entry, cb); }
|
/// for entry in contents.iter() {
|
||||||
/// else { cb(entry); }
|
/// if entry.is_dir() { visit_dirs(entry, cb); }
|
||||||
/// }
|
/// else { cb(entry); }
|
||||||
/// }
|
/// }
|
||||||
/// else { fail!("nope"); }
|
|
||||||
/// }
|
/// }
|
||||||
|
/// else { fail!("nope"); }
|
||||||
|
/// }
|
||||||
|
/// ~~~
|
||||||
trait DirectoryInfo : FileSystemInfo {
|
trait DirectoryInfo : FileSystemInfo {
|
||||||
/// Whether the underlying implemention (be it a file path,
|
/// Whether the underlying implemention (be it a file path,
|
||||||
/// or something else) is pointing at a directory in the underlying FS.
|
/// or something else) is pointing at a directory in the underlying FS.
|
||||||
|
@ -678,7 +686,8 @@ trait DirectoryInfo : FileSystemInfo {
|
||||||
/// `DirectoryInfo` impl for `path::Path`
|
/// `DirectoryInfo` impl for `path::Path`
|
||||||
impl DirectoryInfo for Path { }
|
impl DirectoryInfo for Path { }
|
||||||
|
|
||||||
fn file_test_smoke_test_impl() {
|
#[test]
|
||||||
|
fn file_test_io_smoke_test() {
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
let message = "it's alright. have a good time";
|
let message = "it's alright. have a good time";
|
||||||
let filename = &Path("./tmp/file_rt_io_file_test.txt");
|
let filename = &Path("./tmp/file_rt_io_file_test.txt");
|
||||||
|
@ -701,11 +710,7 @@ fn file_test_smoke_test_impl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn file_test_io_smoke_test() {
|
fn file_test_io_invalid_path_opened_without_create_should_raise_condition() {
|
||||||
file_test_smoke_test_impl();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn file_test_invalid_path_opened_without_create_should_raise_condition_impl() {
|
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
let filename = &Path("./tmp/file_that_does_not_exist.txt");
|
let filename = &Path("./tmp/file_that_does_not_exist.txt");
|
||||||
let mut called = false;
|
let mut called = false;
|
||||||
|
@ -718,12 +723,9 @@ fn file_test_invalid_path_opened_without_create_should_raise_condition_impl() {
|
||||||
assert!(called);
|
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 {
|
do run_in_mt_newsched_task {
|
||||||
let filename = &Path("./tmp/file_another_file_that_does_not_exist.txt");
|
let filename = &Path("./tmp/file_another_file_that_does_not_exist.txt");
|
||||||
let mut called = false;
|
let mut called = false;
|
||||||
|
@ -735,12 +737,9 @@ fn file_test_unlinking_invalid_path_should_raise_condition_impl() {
|
||||||
assert!(called);
|
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 {
|
do run_in_mt_newsched_task {
|
||||||
use str;
|
use str;
|
||||||
let message = "ten-four";
|
let message = "ten-four";
|
||||||
|
@ -768,11 +767,7 @@ fn file_test_io_non_positional_read_impl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn file_test_io_non_positional_read() {
|
fn file_test_io_seek_and_tell_smoke_test() {
|
||||||
file_test_io_non_positional_read_impl();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn file_test_io_seeking_impl() {
|
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
use str;
|
use str;
|
||||||
let message = "ten-four";
|
let message = "ten-four";
|
||||||
|
@ -801,11 +796,7 @@ fn file_test_io_seeking_impl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn file_test_io_seek_and_tell_smoke_test() {
|
fn file_test_io_seek_and_write() {
|
||||||
file_test_io_seeking_impl();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn file_test_io_seek_and_write_impl() {
|
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
use str;
|
use str;
|
||||||
let initial_msg = "food-is-yummy";
|
let initial_msg = "food-is-yummy";
|
||||||
|
@ -831,11 +822,7 @@ fn file_test_io_seek_and_write_impl() {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn file_test_io_seek_and_write() {
|
fn file_test_io_seek_shakedown() {
|
||||||
file_test_io_seek_and_write_impl();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn file_test_io_seek_shakedown_impl() {
|
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
use str; // 01234567890123
|
use str; // 01234567890123
|
||||||
let initial_msg = "qwer-asdf-zxcv";
|
let initial_msg = "qwer-asdf-zxcv";
|
||||||
|
@ -870,11 +857,6 @@ fn file_test_io_seek_shakedown_impl() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn file_test_io_seek_shakedown() {
|
|
||||||
file_test_io_seek_shakedown_impl();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn file_test_stat_is_correct_on_is_file() {
|
fn file_test_stat_is_correct_on_is_file() {
|
||||||
do run_in_mt_newsched_task {
|
do run_in_mt_newsched_task {
|
||||||
|
|
Loading…
Reference in New Issue