Commit Graph

817 Commits

Author SHA1 Message Date
Andreas Ots
20233b9848 std: IPv6 addresses are represented as eight groups of four HEXADECIMAL digits 2013-11-25 08:44:04 +02:00
Patrick Walton
1946265e1a libstd: Change all uses of &fn(A)->B over to |A|->B in libstd 2013-11-19 12:40:19 -08:00
bors
eef913b290 auto merge of #10495 : alexcrichton/rust/more-native-io, r=brson
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-19 10:56:42 -08:00
Alex Crichton
68d5510292 Implement more native file I/O
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-19 09:59:21 -08:00
bors
d57765d8a9 auto merge of #10558 : alexcrichton/rust/faster-stdout, r=pcwalton,pcwalton
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-19 05:16:24 -08:00
Patrick Walton
500a8f15c9 libstd: Change all ~fn()s to procs in the standard library.
This makes `Cell`s no longer necessary in most cases.
2013-11-18 18:27:30 -08:00
Alex Crichton
10b956a012 Allow piped stdout/stderr use uv_tty_t
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-18 16:29:41 -08:00
bors
66df86ae98 auto merge of #10466 : alexcrichton/rust/issue-10334, r=cmr
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-17 01:21:36 -08:00
Alex Crichton
01343d3d29 Implement read_char on the Buffer trait 2013-11-16 02:11:47 -08:00
klutzy
09cb7ecc67 test: Fix signal-exit-status on windows 2013-11-14 14:43:08 +09:00
bors
58b5c618cf auto merge of #10457 : alexcrichton/rust/native-io, r=brson
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-13 19:46:18 -08:00
Alex Crichton
9bcf557589 Implement native::IoFactory
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-13 18:34:59 -08:00
bors
a79ed57beb auto merge of #10451 : zkamsler/rust/buf_writer, r=alexcrichton
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-13 12:21:28 -08:00
Alex Crichton
7bc092f109 Introduce an io::Buffer trait
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-13 11:36:13 -08:00
Zach Kamsler
c2c7a2497d Implemented BufWriter
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-13 14:22:03 -05:00
Corey Richardson
67692b21b5 io: benchmarks for creation of the various Buffered objects 2013-11-12 21:51:15 -05:00
Alex Crichton
49ee49296b Move std::rt::io to std::io 2013-11-11 20:44:07 -08:00