about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2013-12-04Revert "libstd: Change `Path::new` to `Path::init`."Kevin Ballard-35/+34
This reverts commit c54427ddfbbab41a39d14f2b1dc4f080cbc2d41b. Leave the #[ignores] in that were added to rustpkg tests. Conflicts: src/librustc/driver/driver.rs src/librustc/metadata/creader.rs
2013-12-04auto merge of #10804 : alexcrichton/rust/less-dup, r=pcwaltonbors-13/+5
This is just an implementation detail of using libuv, so move the libuv-specific logic into librustuv.
2013-12-04Don't dup the stdio file descriptors.Alex Crichton-13/+5
This is just an implementation detail of using libuv, so move the libuv-specific logic into librustuv.
2013-12-04std::str: s/from_utf8_slice/from_utf8/, to make the basic case shorter.Huon Wilson-9/+9
2013-12-04std::str: remove from_utf8.Huon Wilson-24/+21
This function had type &[u8] -> ~str, i.e. it allocates a string internally, even though the non-allocating version that take &[u8] -> &str and ~[u8] -> ~str are all that is necessary in most circumstances.
2013-12-03Move std::util::ignore to std::prelude::dropSteven Fackler-2/+2
It's a more fitting name for the most common use case of this function.
2013-11-30auto merge of #10738 : sfackler/rust/buffered-fixes, r=alexcrichtonbors-10/+28
BufferedWriter::inner flushes before returning the underlying writer. BufferedWriter::write no longer flushes the underlying writer. LineBufferedWriter::write flushes up to the *last* newline in the input string, not the first.
2013-11-30Fixes for BufferedWriter and LineBufferedWriterSteven Fackler-10/+28
BufferedWriter::inner flushes before returning the underlying writer. BufferedWriter::write no longer flushes the underlying writer. LineBufferedWriter::write flushes up to the *last* newline in the input string, not the first.
2013-12-01std::io::mem: add a with_capacity constructor to MemWriter.Huon Wilson-1/+7
This allows one to reduce the number of reallocs of the internal buffer if one has an approximate idea of the size of the final output.
2013-11-29libstd: Change `Path::new` to `Path::init`.Patrick Walton-34/+35
2013-11-28Register new snapshotsAlex Crichton-27/+27
2013-11-26libstd: Fix Win32 and other bustage.Patrick Walton-2/+4
2013-11-26librustc: Make `||` lambdas not infer to `proc`sPatrick Walton-6/+6
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-75/+75
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-205/+145
2013-11-26Removed unneccessary `_iter` suffixes from various APIsMarvin Löbel-2/+2
2013-11-26rustc: Add lint for obsolete attributesklutzy-1/+0
This also moves `#[auto_{en,de}code]` checker from syntax to lint.
2013-11-25std: IPv6 addresses are represented as eight groups of four HEXADECIMAL digitsAndreas Ots-1/+2
2013-11-19libstd: Change all uses of `&fn(A)->B` over to `|A|->B` in libstdPatrick Walton-26/+31
2013-11-19auto merge of #10495 : alexcrichton/rust/more-native-io, r=brsonbors-644/+866
This implements a fair amount of the unimpl() functionality in io::native relating to filesystem operations. I've also modified all io::fs tests to run in both a native and uv environment (so everything is actually tested). There are a few bits of remaining functionality which I was unable to get working: * truncate on windows * change_file_times on windows * lstat on windows I think that change_file_times may just need a better interface, but the other two have large implementations in libuv which I didn't want to tackle trying to copy. I found a `chsize` function to work for truncate on windows, but it doesn't quite seem to be working out.
2013-11-19Implement more native file I/OAlex Crichton-644/+866
This implements a fair amount of the unimpl() functionality in io::native relating to filesystem operations. I've also modified all io::fs tests to run in both a native and uv environment (so everything is actually tested). There are a two bits of remaining functionality which I was unable to get working: * change_file_times on windows * lstat on windows I think that change_file_times may just need a better interface, but lstat has a large implementation in libuv which I didn't want to tackle trying to copy.
2013-11-19auto merge of #10558 : alexcrichton/rust/faster-stdout, r=pcwalton,pcwaltonbors-0/+1
There are issues with reading stdin when it is actually attached to a pipe, but I have run into no problems in writing to stdout/stderr when they are attached to pipes.
2013-11-18libstd: Change all `~fn()`s to `proc`s in the standard library.Patrick Walton-1/+1
This makes `Cell`s no longer necessary in most cases.
2013-11-18Allow piped stdout/stderr use uv_tty_tAlex Crichton-0/+1
There are issues with reading stdin when it is actually attached to a pipe, but I have run into no problems in writing to stdout/stderr when they are attached to pipes.
2013-11-17auto merge of #10466 : alexcrichton/rust/issue-10334, r=cmrbors-101/+156
These commits create a `Buffer` trait in the `io` module which represents an I/O reader which is internally buffered. This abstraction is used to reasonably implement `read_line` and `read_until` along with at least an ok implementation of `read_char` (although I certainly haven't benchmarked `read_char`).
2013-11-16Implement read_char on the Buffer traitAlex Crichton-0/+43
2013-11-14test: Fix signal-exit-status on windowsklutzy-0/+1
2013-11-13auto merge of #10457 : alexcrichton/rust/native-io, r=brsonbors-319/+405
This commit re-organizes the io::native module slightly in order to have a working implementation of rtio::IoFactory which uses native implementations. The goal is to seamlessly multiplex among libuv/native implementations wherever necessary. Right now most of the native I/O is unimplemented, but we have existing bindings for file descriptors and processes which have been hooked up. What this means is that you can now invoke println!() from libstd with no local task, no local scheduler, and even without libuv. There's still plenty of work to do on the native I/O factory, but this is the first steps into making it an official portion of the standard library. I don't expect anyone to reach into io::native directly, but rather only std::io primitives will be used. Each std::io interface seamlessly falls back onto the native I/O implementation if the local scheduler doesn't have a libuv one (hurray trait ojects!)
2013-11-13Implement native::IoFactoryAlex Crichton-319/+405
This commit re-organizes the io::native module slightly in order to have a working implementation of rtio::IoFactory which uses native implementations. The goal is to seamlessly multiplex among libuv/native implementations wherever necessary. Right now most of the native I/O is unimplemented, but we have existing bindings for file descriptors and processes which have been hooked up. What this means is that you can now invoke println!() from libstd with no local task, no local scheduler, and even without libuv. There's still plenty of work to do on the native I/O factory, but this is the first steps into making it an official portion of the standard library. I don't expect anyone to reach into io::native directly, but rather only std::io primitives will be used. Each std::io interface seamlessly falls back onto the native I/O implementation if the local scheduler doesn't have a libuv one (hurray trait ojects!)
2013-11-13auto merge of #10451 : zkamsler/rust/buf_writer, r=alexcrichtonbors-10/+99
I implemented BufWriter. I realize the use of conditions are on their way out for IO, but it does raise a condition if a write will not fit in the buffer for now. I also replaced the seek code for MemWriter. It was adding the offset as a uint, which is unsound for negative offsets. It only happened to work because unsigned addition performs the same operation with two's complement, and sizeof(uint) <= sizeof(i64) so there was no (lack of) sign extension. I replaced this with computing an offset as an i64 and clamping to zero. I don't expect anyone will have use BufWriter with a byte buffer greater than 2^63 bytes any time soon. @alexcrichton Closes #10433
2013-11-13Introduce an io::Buffer traitAlex Crichton-101/+113
This trait is meant to abstract whether a reader is actually implemented with an underlying buffer. For all readers which are implemented as such, we can efficiently implement things like read_char, read_line, read_until, etc. There are two required methods for managing the internal buffer, and otherwise read_line and friends can all become default methods. Closes #10334
2013-11-13Implemented BufWriterZach Kamsler-10/+99
Filled in the implementations of Writer and Seek for BufWriter. It raises the io_error condition if a write cannot fit in the buffer. The Seek implementation for MemWriter, which was incorrectly using unsigned arithmatic to add signed offsets, has also been replaced.
2013-11-12io: benchmarks for creation of the various Buffered objectsCorey Richardson-0/+42
2013-11-11Move std::rt::io to std::ioAlex Crichton-0/+8639