Fill out the remaining functionality in io::file
This adds bindings to the remaining functions provided by libuv, all of which are useful operations on files which need to get exposed somehow. Some highlights: * Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type * Moved all file-related methods to be static methods under `File` * All directory related methods are still top-level functions * Created `io::FilePermission` types (backed by u32) that are what you'd expect * Created `io::FileType` and refactored `FileStat` to use FileType and FilePermission * Removed the expanding matrix of `FileMode` operations. The mode of reading a file will not have the O_CREAT flag, but a write mode will always have the O_CREAT flag. Closes #10130 Closes #10131 Closes #10121
This commit is contained in:
parent
9c1851019f
commit
f19d083362
38 changed files with 1381 additions and 1030 deletions
|
@ -26,7 +26,7 @@ extern mod extra;
|
|||
use std::cell::Cell;
|
||||
use std::local_data;
|
||||
use std::rt::io;
|
||||
use std::rt::io::file;
|
||||
use std::rt::io::File;
|
||||
use std::rt::io::mem::MemWriter;
|
||||
use std::rt::io::Decorator;
|
||||
use std::str;
|
||||
|
@ -259,7 +259,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
|
|||
/// This input format purely deserializes the json output file. No passes are
|
||||
/// run over the deserialized output.
|
||||
fn json_input(input: &str) -> Result<Output, ~str> {
|
||||
let input = match file::open(&Path::new(input)) {
|
||||
let input = match File::open(&Path::new(input)) {
|
||||
Some(f) => f,
|
||||
None => return Err(format!("couldn't open {} for reading", input)),
|
||||
};
|
||||
|
@ -321,7 +321,7 @@ fn json_output(crate: clean::Crate, res: ~[plugins::PluginJson], dst: Path) {
|
|||
json.insert(~"crate", crate_json);
|
||||
json.insert(~"plugins", json::Object(plugins_json));
|
||||
|
||||
let mut file = file::create(&dst).unwrap();
|
||||
let mut file = File::create(&dst).unwrap();
|
||||
let output = json::Object(json).to_str();
|
||||
file.write(output.as_bytes());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue