summary refs log tree commit diff
path: root/src/libstd/io/stdio.rs
AgeCommit message (Collapse)AuthorLines
2017-11-08std: Change how EBADF is handled in `sys`Alex Crichton-3/+1
This commit removes the reexport of `EBADF_ERR` as a constant from libstd's portability facade, instead opting for a platform-specific function that specifically queries an `io::Error`. Not all platforms may have a constant for this, so it makes the intent a little more clear that a code need not be supplied, just an answer to a query.
2017-06-20Add `Read::initializer`.Steven Fackler-11/+12
This is an API that allows types to indicate that they can be passed buffers of uninitialized memory which can improve performance.
2017-05-10Fix up stability annotations per feedback.Zack Weinberg-2/+2
2017-05-10Revise the eprint(ln)! feature.Zack Weinberg-50/+29
* Factor out the nigh-identical bodies of `_print` and `_eprint` to a helper function `print_to` (I was sorely tempted to call it `_doprnt`). * Update the issue number for the unstable `eprint` feature. * Add entries to the "unstable book" for `eprint` and `eprint_internal`. * Style corrections to the documentation.
2017-05-10Add `eprint!` and `eprintln!` macros to the prelude.Zack Weinberg-0/+36
These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout. Issue #39228.
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-2/+2
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-01-29Fix a few impl stability attributesOliver Middleton-6/+6
The versions show up in rustdoc.
2017-01-22libstd: replace all `try!` with `?` in documentation examplesUtkarsh Kukreti-9/+9
See #38644.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-0/+42
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-12-16Address falloutAaron Turon-3/+3
2016-11-28Move stdout/err flush into sysJeremy Soller-6/+0
2016-11-10Merge branch 'master' into redoxJeremy Soller-1/+2
2016-11-10Fixes for stdio and processes on RedoxJeremy Soller-0/+6
2016-11-05add missing urls on io structsGuillaume Gomez-1/+2
2016-11-01std: Move a plattform-specific constant to sys::stdioBrian Anderson-9/+1
2016-10-01std: Move platform specific stdio code into sysBrian Anderson-5/+2
2016-09-30Change the sigs of set_print/set_panic to allow restoring the default objectsBrian Anderson-4/+4
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+1
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-1/+0
2016-07-30Add doc example for StdoutGuillaume Gomez-0/+15
2016-07-30Add doc example for StdinGuillaume Gomez-0/+15
2016-07-30Add doc example for io::StderrGuillaume Gomez-0/+15
2016-03-23doc: Stdin is locked for reads, not writesBrian Anderson-2/+2
2016-03-10Fixup stout/stderr on WindowsOliver Middleton-19/+2
WriteConsoleW can fail if called with a large buffer so we need to slice any stdout/stderr output. However the current slicing has a few problems: 1. It slices by byte but still expects valid UTF-8. 2. The slicing happens even when not outputting to a console. 3. panic! output is not sliced. This fixes these issues by moving the slice to right before WriteConsoleW and slicing on a char boundary.
2016-03-08std: Funnel read_to_end through to one locationAlex Crichton-2/+10
This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`.
2016-01-25std: Fix some behavior without stdio handlesAlex Crichton-1/+1
On all platforms, reading from stdin where the actual stdin isn't present should return 0 bytes as having been read rather than the entire buffer. On Windows, handle the case where we're inheriting stdio handles but one of them isn't present. Currently the behavior is to fail returning an I/O error but instead this commit corrects it to detecting this situation and propagating the non-set handle. Closes #31167
2015-12-30doc: missed these in a4da9acTshepang Lekhonkhobe-2/+2
2015-12-30doc: add gravesTshepang Lekhonkhobe-23/+23
2015-12-30doc: add some links for io::stdioTshepang Lekhonkhobe-14/+35
2015-12-23doc: make line visibleTshepang Lekhonkhobe-1/+1
2015-11-09std: Migrate to the new libcAlex Crichton-3/+2
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c
2015-10-31std: Prevent print panics when using TLSAlex Crichton-8/+26
Currently if a print happens while a thread is being torn down it may cause a panic if the LOCAL_STDOUT TLS slot has been destroyed by that point. This adds a guard to check and prints to the process stdout if that's the case (as we do for if the slot is already borrowed). Closes #29488
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-3/+3
2015-08-30Auto merge of #27588 - cesarb:read_all, r=alexcrichtonbors-0/+3
This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980). Tracking issue: https://github.com/rust-lang/rust/issues/27585
2015-08-24Implement read_exact for the Read traitCesar Eduardo Barros-0/+3
This implements the proposed "read_exact" RFC (https://github.com/rust-lang/rfcs/pull/980).
2015-08-15std: Add issues to all unstable featuresAlex Crichton-3/+6
2015-08-11correct copy/paste typos in stdio.rs commentsAlex Burka-4/+4
I'm not 100% sure lines 63 and 73 are typos.
2015-07-31Auto merge of #26897 - RalfJung:stdin-mut, r=alexcrichtonbors-1/+1
This fixes #26890. To be honest, the local compile-test is still running. This just takes so long. But this looks trivial enough...
2015-07-15Add specializations of read_to_end for Stdin, TcpStream and File,Alisdair Owens-0/+4
allowing them to read into a buffer containing uninitialized data, rather than pay the cost of zeroing.
2015-07-10Add more std::io documentation.Steve Klabnik-15/+97
This round: io::Result and the free functions.
2015-07-08Stdin::read_line: read_line does not need a mutable borrowRalf Jung-1/+1
2015-06-30doc: add example for Stdin::read_lineTshepang Lekhonkhobe-0/+22
2015-06-14Implement RFC 1014Steven Fackler-19/+77
Closes #25977 The various `stdfoo_raw` methods in std::io now return `io::Result`s, since they may not exist on Windows. They will always return `Ok` on Unix-like platforms. [breaking-change]
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-3/+3
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-6/+6
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-1/+1
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-22Explain how to create a Stdin or StdoutMatt Brubeck-0/+4
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-7/+7
2015-04-08Implement reentrant mutexes and make stdio use themSimonas Kazlauskas-17/+25
write_fmt calls write for each formatted field. The default implementation of write_fmt is used, which will call write on not-yet-locked stdout (and write locking after), therefore making print! in multithreaded environment still interleave contents of two separate prints. This patch implements reentrant mutexes, changes stdio handles to use these mutexes and overrides write_fmt to lock the stdio handle for the whole duration of the call.
2015-03-27std: Don't deadlock/panic on recursive printsAlex Crichton-11/+13
Previously a panic was generated for recursive prints due to a double-borrow of a `RefCell`. This was solved by the second borrow's output being directed towards the global stdout instead of the per-thread stdout (still experimental functionality). After this functionality was altered, however, recursive prints still deadlocked due to the overridden `write_fmt` method which locked itself first and then wrote all the data. This was fixed by removing the override of the `write_fmt` method. This means that unlocked usage of `write!` on a `Stdout`/`Stderr` may be slower due to acquiring more locks, but it's easy to make more performant with a call to `.lock()`. Closes #23781