about summary refs log tree commit diff
path: root/src/libstd/rt/io/mod.rs
AgeCommit message (Collapse)AuthorLines
2013-11-11Move std::rt::io to std::ioAlex Crichton-1224/+0
2013-11-10Another round of test fixes from previous commitsAlex Crichton-1/+5
2013-11-10Add bindings to uv's utime functionAlex Crichton-2/+3
This exposes the ability to change the modification and access times on a file. Closes #10266
2013-11-04Move io::file to io::fs and fns out of FileAlex Crichton-4/+20
This renames the `file` module to `fs` because that more accurately describes its current purpose (manipulating the filesystem, not just files). Additionally, this adds an UnstableFileStat structure as a nested structure of FileStat to signify that the fields should not be depended on. The structure is currently flagged with #[unstable], but it's unlikely that it has much meaning. Closes #10241
2013-11-03Fill out the remaining functionality in io::fileAlex Crichton-37/+82
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
2013-11-03Remove all blocking std::os blocking functionsAlex Crichton-1/+20
This commit moves all thread-blocking I/O functions from the std::os module. Their replacements can be found in either std::rt::io::file or in a hidden "old_os" module inside of native::file. I didn't want to outright delete these functions because they have a lot of special casing learned over time for each OS/platform, and I imagine that these will someday get integrated into a blocking implementation of IoFactory. For now, they're moved to a private module to prevent bitrot and still have tests to ensure that they work. I've also expanded the extensions to a few more methods defined on Path, most of which were previously defined in std::os but now have non-thread-blocking implementations as part of using the current IoFactory. The api of io::file is in flux, but I plan on changing it in the next commit as well. Closes #10057
2013-10-31libstd: Remove mocks.Patrick Walton-3/+0
2013-10-30Make Writer::flush a no-op default methodAlex Crichton-2/+6
Closes #9126
2013-10-28Remove the extension traits for Readers/WritersAlex Crichton-7/+468
These methods are all excellent candidates for default methods, so there's no need to require extra imports of various traits.
2013-10-26Implement another error code found on windows.Alex Crichton-0/+2
Closes #8811
2013-10-24Implement a basic event loop built on LittleLockAlex Crichton-0/+7
It's not guaranteed that there will always be an event loop to run, and this implementation will serve as an incredibly basic one which does not provide any I/O, but allows the scheduler to still run. cc #9128
2013-10-24wrapping libuv signal for use in RustDo Nhat Minh-0/+3
descriptive names easier-to-use api reorganize and document
2013-10-24Remove io::read_errorAlex Crichton-7/+1
The general idea is to remove conditions completely from I/O, so in the meantime remove the read_error condition to mean the same thing as the io_error condition.
2013-10-24Move as much I/O as possible off of native::ioAlex Crichton-0/+2
When uv's TTY I/O is used for the stdio streams, the file descriptors are put into a non-blocking mode. This means that other concurrent writes to the same stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we avoid this error. There is one location which cannot move, which is the runtime's dumb_println function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and simply retry again and again.
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-2/+4
This involved changing a fair amount of code, rooted in how we access the local IoFactory instance. I added a helper method to the rtio module to access the optional local IoFactory. This is different than before in which it was assumed that a local IoFactory was *always* present. Now, a separate io_error is raised when an IoFactory is not present, yet I/O is requested.
2013-10-24Remove rt::io::supportAlex Crichton-4/+0
This removes the PathLike trait associated with this "support module". This is yet another "container of bytes" trait, so I didn't want to duplicate what already exists throughout libstd. In actuality, we're going to pass of C strings to the libuv APIs, so instead the arguments are now bound with the 'ToCStr' trait instead. Additionally, a layer of complexity was removed by immediately converting these type-generic parameters into CStrings to get handed off to libuv apis.
2013-10-24Remove unbound pipes from io::pipeAlex Crichton-1/+0
This isn't necessary for creating processes (or at least not right now), and it inherently attempts to expose implementation details.
2013-10-24Address a few XXX comments throughout the runtimeAlex Crichton-2/+1
* Implement Seek for Option<Seek> * Remove outdated comment for io::process * De-pub a component which didn't need to be pub
2013-10-23Merge remote-tracking branch 'upstream/master'Ziad Hatahet-2/+2
2013-10-22Remove thread-blocking call to `libc::stat` in `Path::stat`Ziad Hatahet-0/+6
Fixes #9958
2013-10-22Minor grammatical fixes and removed section on 'rust' toolMichael Letterle-2/+2
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-1/+1
Who doesn't like a massive renaming?
2013-10-16auto merge of #9721 : klutzy/rust/uv-net-read-fix, r=alexcrichtonbors-0/+2
See #9605 for detailed information. This also fixes two tests of #8811.
2013-10-10auto merge of #9749 : alexcrichton/rust/less-io, r=brsonbors-2/+25
This implements a number of the baby steps needed to start eliminating everything inside of `std::io`. It turns out that there are a *lot* of users of that module, so I'm going to try to tackle them separately instead of bringing down the whole system all at once. This pull implements a large amount of unimplemented functionality inside of `std::rt::io` including: * Native file I/O (file descriptors, *FILE) * Native stdio (through the native file descriptors) * Native processes (extracted from `std::run`) I also found that there are a number of users of `std::io` which desire to read an input line-by-line, so I added an implementation of `read_until` and `read_line` to `BufferedReader`. With all of these changes in place, I started to axe various usages of `std::io`. There's a lot of one-off uses here-and-there, but the major use-case remaining that doesn't have a fantastic solution is `extra::json`. I ran into a few compiler bugs when attempting to remove that, so I figured I'd come back to it later instead. There is one fairly major change in this pull, and it's moving from native stdio to uv stdio via `print` and `println`. Unfortunately logging still goes through native I/O (via `dumb_println`). This is going to need some thinking, because I still want the goal of logging/printing to be 0 allocations, and this is not possible if `io::stdio::stderr()` is called on each log message. Instead I think that this may need to be cached as the `logger` field inside the `Task` struct, but that will require a little more workings to get right (this is also a similar problem for print/println, do we cache `stdout()` to not have to re-create it every time?).
2013-10-10Remove some users of io::file_readerAlex Crichton-0/+20
2013-10-10Migrate users of io::fd_t to io::native::file::fd_tAlex Crichton-2/+5
2013-10-08Make std::rt::io::extensions publicSteven Fackler-1/+1
This works around #9779, but is probably the right thing to do anyways since that's the module where all of the documentation for those traits lives.
2013-10-07Fix existing privacy/visibility violationsAlex Crichton-1/+2
This commit fixes all of the fallout of the previous commit which is an attempt to refine privacy. There were a few unfortunate leaks which now must be plugged, and the most horrible one is the current `shouldnt_be_public` module now inside `std::rt`. I think that this either needs a slight reorganization of the runtime, or otherwise it needs to just wait for the external users of these modules to get replaced with their `rt` implementations. Other fixes involve making things pub which should be pub, and otherwise updating error messages that now reference privacy instead of referencing an "unresolved name" (yay!).
2013-10-05std::rt: Add NotConnected to IoErrorKindklutzy-0/+2
2013-09-30std: Remove usage of fmt!Alex Crichton-1/+1
2013-09-24Stop accepting 'impl ...;', require {} insteadAlex Crichton-1/+1
Progress on #7981
2013-09-18Implement process bindings to libuvAlex Crichton-0/+9
This is a re-landing of #8645, except that the bindings are *not* being used to power std::run just yet. Instead, this adds the bindings as standalone bindings inside the rt::io::process module. I made one major change from before, having to do with how pipes are created/bound. It's much clearer now when you can read/write to a pipe, as there's an explicit difference (different types) between an unbound and a bound pipe. The process configuration now takes unbound pipes (and consumes ownership of them), and will return corresponding pipe structures back if spawning is successful (otherwise everything is destroyed normally).
2013-09-18Register new snapshotsAlex Crichton-6/+2
2013-09-16std: generlize & move io::file::suppressed_stat to io::ignore_io_errorJeff Olson-0/+12
2013-09-16std: expose more stat infoJeff Olson-6/+2
2013-09-16std: clean up Dir/FileInfo inheritence and flesh out Dir InfoJeff Olson-2/+8
2013-09-16std/rt: in-progress file io workJeff Olson-0/+24
std: remove unneeded field from RequestData struct std: rt::uv::file - map us_fs_stat & start refactoring calls into FsRequest std: stubbing out stat calls from the top-down into uvio std: us_fs_* operations are now by-val self methods on FsRequest std: post-rebase cleanup std: add uv_fs_mkdir|rmdir + tests & minor test cleanup in rt::uv::file WORKING: fleshing out FileStat and FileInfo + tests std: reverting test files.. refactoring back and cleanup...
2013-09-10Buffered I/O wrappersSteven Fackler-0/+3
The default buffer size is the same as the one in Java's BufferedWriter. We may want BufferedWriter to have a Drop impl that flushes, but that isn't possible right now due to #4252/#4430. This would be a bit awkward due to the possibility of the inner flush failing. For what it's worth, Java's BufferedReader doesn't have a flushing finalizer, but that may just be because Java's finalizer support is awful. Closes #8953
2013-09-06Fix Acceptor iterator ending early if a connection attempt failsEric Reed-4/+9
2013-09-05std::rt: Add get_host_addresses functionBrian Anderson-7/+1
This is a very simplistic method for host name resolution. It converts a host name to a vector of IP addresses. Should be enough to get started.
2013-09-05Implement Stream automatically for Reader + WriterChris Morgan-0/+2
This is consistent with the existing documentation but was not the actual behaviour, which I've found to be rather a nuisance, actually.
2013-09-04Added explicit pub to several conditions. Enables completion of #6009.Felix S. Klock II-5/+3
2013-09-03auto merge of #8963 : jmgrosen/rust/issue-8881, r=alexcrichtonbors-0/+4
2013-09-03Fixes #8881. condition! imports parent's pub identifiersjmgrosen-0/+4
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-3/+0
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-27Implement process bindings to libuvAlex Crichton-0/+3
Closes #6436
2013-08-22std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file::Jeff Olson-0/+24
2013-08-22std: rework file io.. support [p]read,[p]write, impl seek/tell + more testsJeff Olson-0/+1
2013-08-21auto merge of #8600 : sfackler/rust/http, r=brsonbors-1/+0
It's an empty stub and as one of the comments notes, doesn't belong in libstd.
2013-08-18Delete std::rt::io::net::httpSteven Fackler-1/+0
It's an empty stub and as one of the comments notes, doesn't belong in libstd.