about summary refs log tree commit diff
path: root/src/libstd/rt/io
AgeCommit message (Collapse)AuthorLines
2013-10-24Move stdin to using libuv's pipes instead of a ttyAlex Crichton-30/+18
I was seeing a lot of weird behavior with stdin behaving as a tty, and it doesn't really quite make sense, so instead this moves to using libuv's pipes instead (which make more sense for stdin specifically). This prevents piping input to rustc hanging forever.
2013-10-24Remove io::read_errorAlex Crichton-44/+38
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-24/+52
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-24Migrate the last typedefs to ~Trait in rtioAlex Crichton-4/+4
There are no longer any remnants of typedefs, and everything is now built on true trait objects.
2013-10-24Don't attempt to export uv functions directlyAlex Crichton-14/+0
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-183/+157
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-74/+23
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-24Migrate Rtio objects to true trait objectsAlex Crichton-26/+21
This moves as many as I could over to ~Trait instead of ~Typedef. The only remaining one is the IoFactoryObject which should be coming soon...
2013-10-24Move rt::io::stdio from FileStream to a TTYAlex Crichton-14/+88
We get a little more functionality from libuv for these kinds of streams (things like terminal dimentions), and it also appears to more gracefully handle the stream being a window. Beforehand, if you used stdio and hit CTRL+d on a process, libuv would continually return 0-length successful reads instead of interpreting that the stream was closed. I was hoping to be able to write tests for this, but currently the testing infrastructure doesn't allow tests with a stdin and a stdout, but this has been manually tested! (not that it means much)
2013-10-24Remove unbound pipes from io::pipeAlex Crichton-29/+4
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-12/+20
* Implement Seek for Option<Seek> * Remove outdated comment for io::process * De-pub a component which didn't need to be pub
2013-10-24Finish implementing io::net::addrinfoAlex Crichton-46/+129
This fills in the `hints` structure and exposes libuv's full functionality for doing dns lookups.
2013-10-24Implement io::net::unixAlex Crichton-19/+271
2013-10-23Merge remote-tracking branch 'upstream/master'Ziad Hatahet-9/+9
2013-10-22Remove thread-blocking call to `libc::stat` in `Path::stat`Ziad Hatahet-2/+8
Fixes #9958
2013-10-22auto merge of #10020 : mletterle/rust/documentation-fixes, r=thestingerbors-2/+2
I'm planning on doing more updates, but the section in the tutorial stood out at me since the 'rust' tool no longer exists, this should probably be removed to lessen confusion.
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-34/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-7/+41
2013-10-22Minor grammatical fixes and removed section on 'rust' toolMichael Letterle-2/+2
2013-10-22Drop the '2' suffix from logging macrosAlex Crichton-82/+82
Who doesn't like a massive renaming?
2013-10-20Don't allocate a string when calling printlnAlex Crichton-1/+18
Instead use format_args! to pass around a struct to pass along into std::fmt
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-2/+2
2013-10-16auto merge of #9721 : klutzy/rust/uv-net-read-fix, r=alexcrichtonbors-6/+22
See #9605 for detailed information. This also fixes two tests of #8811.
2013-10-15path2: Adjust the API to remove all the _str mutation methodsKevin Ballard-15/+15
Add a new trait BytesContainer that is implemented for both byte vectors and strings. Convert Path::from_vec and ::from_str to one function, Path::new(). Remove all the _str-suffixed mutation methods (push, join, with_*, set_*) and modify the non-suffixed versions to use BytesContainer.
2013-10-15path2: Replace the path module outrightKevin Ballard-23/+27
Remove the old path. Rename path2 to path. Update all clients for the new path. Also make some miscellaneous changes to the Path APIs to help the adoption process.
2013-10-10auto merge of #9749 : alexcrichton/rust/less-io, r=brsonbors-59/+1222
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-10Make the file::DirectoryInfo trait publicAlex Crichton-1/+1
This was just a mistake that it was hidden.
2013-10-10Remove some users of io::file_readerAlex Crichton-4/+24
2013-10-10Migrate users of io::fd_t to io::native::file::fd_tAlex Crichton-2/+5
2013-10-10Implement BufferedReader.{read_until, read_line}Alex Crichton-7/+65
These two functions will be useful when replacing various other counterparts used by std::io consumers.
2013-10-10Implement rt::io::stdioAlex Crichton-25/+83
Additionally, this moves the prelude imports of print/println from std::io to std::rt::io. Closes #6846
2013-10-09auto merge of #9780 : sfackler/rust/extensions2, r=alexcrichtonbors-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-09Implement io::native::processAlex Crichton-0/+752
2013-10-09Implement io::native::stdioAlex Crichton-0/+67
2013-10-09Implement io::native::fileAlex Crichton-25/+230
2013-10-09option: rewrite the API to use compositionDaniel Micay-7/+7
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-3/+5
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-05rt::io::net::tcp: Fix eof_twice tests on Win32klutzy-6/+20
cc #8811
2013-10-05std::rt: Add NotConnected to IoErrorKindklutzy-0/+2
2013-10-03Close out #9155Steven Fackler-13/+9
Add a test to make sure it works and switch a private struct over to a newtype. Closes #9155
2013-10-02Stop using newtype wrappers in std::rt::ioSteven Fackler-30/+48
UnboundedPipeStream is still a newtype since process::set_stdio needs to look into its internals. Closes #9667
2013-10-01auto merge of #9578 : alexcrichton/rust/un-ignore-libuv-process-tests, r=brsonbors-142/+2
Closes #9341
2013-10-01Move the rt::io::process tests to run-passAlex Crichton-142/+2
Closes #9341
2013-09-30std: Remove usage of fmt!Alex Crichton-118/+104
2013-09-26Visibility fixesSteven Fackler-11/+11
2013-09-25Some struct visibility fixesSteven Fackler-2/+2
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-16/+16
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-24auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphismbors-1/+1
Progress on #7981 This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
2013-09-24Stop accepting 'impl ...;', require {} insteadAlex Crichton-1/+1
Progress on #7981