about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2014-01-03libsyntax: Fix tests.Patrick Walton-0/+1
2014-01-03libstd: Remove a spurious `@mut` from a disabled testPatrick Walton-2/+3
2014-01-03Add read_to_str and write_{str, line}Alex Crichton-24/+73
These methods are sorely needed on readers and writers, and I believe that the encoding story should be solved with composition. This commit adds back the missed functions when reading/writing strings onto generic Readers/Writers.
2014-01-01auto merge of #11245 : alexcrichton/rust/issue-11225, r=pcwaltonbors-0/+2
Commit messages are a little more descriptive.
2014-01-01Don't leave lingering files in doc testsAlex Crichton-0/+2
Closes #11234
2013-12-31Implement native UDP I/OAlex Crichton-23/+25
2013-12-28auto merge of #11159 : alexcrichton/rust/native-io, r=pcwaltonbors-74/+197
The old `rtio-processes` run-pass test is now moved into libstd's `io::process` module, and all process and TCP tests are now run with `iotest!` (both a native and a green version are tested). All TCP networking on windows is provided by `ws2_32` which is apparently very similar to unix networking (hurray!).
2013-12-27Implement native TCP I/OAlex Crichton-70/+46
2013-12-27Bring native process bindings up to dateAlex Crichton-5/+151
Move the tests into libstd, use the `iotest!` macro to test both native and uv bindings, and use the cloexec trick to figure out when the child process fails in exec.
2013-12-27auto merge of #11098 : erickt/rust/collect, r=alexcrichtonbors-2/+1
This patch changes `result::collect` (and adds a new `option::collect`) from creating a `~[T]` to take an `Iterator`. This makes the function much more flexible, and may replace the need for #10989. This patch is a little more complicated than it needs to be because of #11084. Once that is fixed we can replace the `CollectIterator` with a `Scan` iterator. It also fixes a test warning.
2013-12-26std: remove some test warningsErick Tryzelaar-2/+1
2013-12-25Test fixes and rebase conflictsAlex Crichton-3/+4
* vec::raw::to_ptr is gone * Pausible => Pausable * Removing @ * Calling the main task "<main>" * Removing unused imports * Removing unused mut * Bringing some libextra tests up to date * Allowing compiletest to work at stage0 * Fixing the bootstrap-from-c rmake tests * assert => rtassert in a few cases * printing to stderr instead of stdout in fail!()
2013-12-24Test fixes and rebase problemsAlex Crichton-0/+79
Note that this removes a number of run-pass tests which are exercising behavior of the old runtime. This functionality no longer exists and is thoroughly tested inside of libgreen and libnative. There isn't really the notion of "starting the runtime" any more. The major notion now is "bootstrapping the initial task".
2013-12-24rustuv: Get all tests passing again after refactorAlex Crichton-3/+2
All tests except for the homing tests are now working again with the librustuv/libgreen refactoring. The homing-related tests are currently commented out and now placed in the rustuv::homing module. I plan on refactoring scheduler pool spawning in order to enable more homing tests in a future commit.
2013-12-24std: Get stdtest all passing againAlex Crichton-117/+113
This commit brings the library up-to-date in order to get all tests passing again
2013-12-24native: Introduce libnativeAlex Crichton-1852/+0
This commit introduces a new crate called "native" which will be the crate that implements the 1:1 runtime of rust. This currently entails having an implementation of std::rt::Runtime inside of libnative as well as moving all of the native I/O implementations to libnative. The current snag is that the start lang item must currently be defined in libnative in order to start running, but this will change in the future. Cool fact about this crate, there are no extra features that are enabled. Note that this commit does not include any makefile support necessary for building libnative, that's all coming in a later commit.
2013-12-24std: Handle prints with literally no contextAlex Crichton-1/+11
Printing is an incredibly useful debugging utility, and it's not much help if your debugging prints just trigger an obscure abort when you need them most. In order to handle this case, forcibly fall back to a libc::write implementation of printing whenever a local task is not available. Note that this is *not* a 1:1 fallback. All 1:1 rust tasks will still have a local Task that it can go through (and stdio will be created through the local IO factory), this is only a fallback for "no context" rust code (such as that setting up the context).
2013-12-24std: Expose that LocalIo may not always be availableAlex Crichton-153/+81
It is not the case that all programs will always be able to acquire an instance of the LocalIo borrow, so this commit exposes this limitation by returning Option<LocalIo> from LocalIo::borrow(). At the same time, a helper method LocalIo::maybe_raise() has been added in order to encapsulate the functionality of raising on io_error if there is on local I/O available.
2013-12-24std: Delete rt::testAlex Crichton-590/+583
This module contains many M:N specific concepts. This will no longer be available with libgreen, and most functions aren't really that necessary today anyway. New testing primitives will be introduced as they become available for 1:1 and M:N. A new io::test module is introduced with the new ip4/ip6 address helpers to continue usage in io tests.
2013-12-23auto merge of #11022 : spaolacci/rust/0read, r=alexcrichtonbors-3/+31
Could prevent callers from catching the situation and lead to e.g early iterator terminations (cf. `Reader::read_byte`) since `None` is only to be returned only on EOF.
2013-12-23Fixing more doc testsAlex Crichton-1/+7
2013-12-23std: Fix all code examplesAlex Crichton-4/+20
2013-12-23Add tests for 0-byte read propagation.Sébastien Paolacci-0/+28
The two `Some(0)' used to be `None' before the patch, a zero-byte long read exhausting a reader (and thereafter) still produce a `None'.
2013-12-20auto merge of #10986 : adridu59/rust/patch-new, r=alexcrichtonbors-3/+3
Thanks to @huonw for some mentoring. :cake:
2013-12-20doc: forward-port the conditions tutorial + fixup libstd exampleAdrien Tétar-3/+3
2013-12-20auto merge of #11081 : alexcrichton/rust/comm-adapters, r=huonwbors-2/+5
I accidentally removed this module from compilation awhile back, this adds it back in. Closes #11076
2013-12-19Get comm_adapters building againAlex Crichton-2/+5
I accidentally removed this module from compilation awhile back, this adds it back in. Closes #11076
2013-12-20std: silence warnings when compiling test.Huon Wilson-11/+4
2013-12-19std::vec: remove .as_imm_buf, replaced by .as_ptr & .len.Huon Wilson-6/+7
There's no need for the restrictions of a closure with the above methods.
2013-12-17auto merge of #10863 : cadencemarseille/rust/patch-handle-ENOENT, r=alexcrichtonbors-1/+1
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-17Handle ENOENTCadence Marseille-1/+1
Translate ENOENT to IoErrorKind::FileNotFound.
2013-12-16Test fallout from std::comm rewriteAlex Crichton-2/+2
2013-12-16Fallout of rewriting std::commAlex Crichton-182/+117
2013-12-16Make BufferedReader propagate 0-byte long reads.Sébastien Paolacci-3/+3
Could prevent callers from catching the situation and lead to e.g early iterator terminations (cf. `Reader::read_byte') since `None' is only to be returned only on EOF.
2013-12-15auto merge of #10984 : huonw/rust/clean-raw, r=cmrbors-17/+15
See commits for details.
2013-12-15std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].Huon Wilson-3/+3
2013-12-15Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.Huon Wilson-5/+5
2013-12-15std::vec: remove unnecessary count parameter on {bytes,Huon Wilson-9/+7
raw}::copy_memory. Slices carry their length with them, so we can just use that information.
2013-12-15std: fix spelling in docs.Huon Wilson-14/+14
2013-12-13auto merge of #10895 : sfackler/rust/io-util, r=alexcrichtonbors-0/+298
This adds a bunch of useful Reader and Writer implementations. I'm not a huge fan of the name `util` but I can't think of a better name and I don't want to make `std::io` any longer than it already is.
2013-12-11Add std::io::utilSteven Fackler-0/+298
This adds a bunch of useful Reader and Writer implementations. I'm not a huge fan of the name `util` but I can't think of a better name and I don't want to make `std::io` any longer than it already is.
2013-12-11Make 'self lifetime illegal.Erik Price-26/+26
Also remove all instances of 'self within the codebase. This fixes #10889.
2013-12-11std::io: Add Buffer.lines(), change .bytes() apiklutzy-52/+136
- `Buffer.lines()` returns `LineIterator` which yields line using `.read_line()`. - `Reader.bytes()` now takes `&mut self` instead of `self`. - `Reader.read_until()` swallows `EndOfFile`. This also affects `.read_line()`.
2013-12-10libstd: Remove `Cell` from the library.Patrick Walton-1/+1
2013-12-10librustuv: Change `with_local_io` to use RAII.Patrick Walton-131/+128
2013-12-10librustpkg: Make `io::ignore_io_error()` use RAII; remove a few morePatrick Walton-2/+3
cells.
2013-12-10libextra: Another round of de-`Cell`-ing.Patrick Walton-93/+45
34 uses of `Cell` remain.
2013-12-10Implement PortReader and ChanWriterRaphael Speyer-11/+172
2013-12-08Remove dead codesKiet Tran-8/+5
2013-12-04auto merge of #10796 : kballard/rust/revert-new-naming, r=alexcrichtonbors-35/+34
Rename the `*::init()` functions back to `*::new()`, since `new` is not going to become a keyword.