diff options
| author | bors <bors@rust-lang.org> | 2013-09-17 14:05:45 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-17 14:05:45 -0700 |
| commit | c135cb268355afe77d2ce0313a8d3e20a4e2fdd3 (patch) | |
| tree | 561787933db67139783cc13d1d2ac276391120f3 /src/libstd/rt/rtio.rs | |
| parent | 9e8fb4ad61cfe97413eb92d764aa6aeeb23d5afa (diff) | |
| parent | 70152ff55722878cde684ee6462c14c65f2c4729 (diff) | |
| download | rust-c135cb268355afe77d2ce0313a8d3e20a4e2fdd3.tar.gz rust-c135cb268355afe77d2ce0313a8d3e20a4e2fdd3.zip | |
auto merge of #9235 : olsonjeffery/rust/newrt_file_io_1, r=thestinger
A quick rundown:
- added `file::{readdir, stat, mkdir, rmdir}`
- Added access-constrained versions of `FileStream`; `FileReader` and `FileWriter` respectively
- big rework in `uv::file` .. most actions are by-val-self methods on `FsRequest`; `FileDescriptor` has gone the way of the dinosaurs
- playing nice w/ homing IO (I just copied ecr's work, hehe), etc
- added `FileInfo` trait, with an impl for `Path`
- wrapper for file-specific actions, with the file path always implied by self's value
- has the means to create `FileReader` & `FileWriter` (this isn't exposed in the top-level free function API)
- has "safe" wrappers for `stat()` that won't throw in the event of non-existence/error (in this case, I mean `is_file` and `exists`)
- actions should fail if done on non-regular-files, as appropriate
- added `DirectoryInfo` trait, with an impl for `Path`
- pretty much ditto above, but for directories
- added `readdir` (!!) to iterate over entries in a dir as a `~[Path]` (this was *brutal* to get working)
...<del>and lots of other stuff</del>not really. Do your worst!
Diffstat (limited to 'src/libstd/rt/rtio.rs')
| -rw-r--r-- | src/libstd/rt/rtio.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstd/rt/rtio.rs b/src/libstd/rt/rtio.rs index c9c402baaf0..d05a3a26169 100644 --- a/src/libstd/rt/rtio.rs +++ b/src/libstd/rt/rtio.rs @@ -18,7 +18,7 @@ use rt::uv::uvio; use path::Path; use super::io::support::PathLike; use super::io::{SeekStyle}; -use super::io::{FileMode, FileAccess}; +use super::io::{FileMode, FileAccess, FileStat}; // XXX: ~object doesn't work currently so these are some placeholder // types to use instead @@ -74,6 +74,11 @@ pub trait IoFactory { -> Result<~RtioFileStream, IoError>; fn fs_unlink<P: PathLike>(&mut self, path: &P) -> Result<(), IoError>; fn get_host_addresses(&mut self, host: &str) -> Result<~[IpAddr], IoError>; + fn fs_stat<P: PathLike>(&mut self, path: &P) -> Result<FileStat, IoError>; + fn fs_mkdir<P: PathLike>(&mut self, path: &P) -> Result<(), IoError>; + fn fs_rmdir<P: PathLike>(&mut self, path: &P) -> Result<(), IoError>; + fn fs_readdir<P: PathLike>(&mut self, path: &P, flags: c_int) -> + Result<~[Path], IoError>; } pub trait RtioTcpListener : RtioSocket { |
