summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2017-11-14Fixed several pulldown warnings when documenting libstd.kennytm-2/+2
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-11-06Auto merge of #45369 - fintelia:patch-1, r=BurntSushibors-0/+25
Implement is_empty() for BufReader Simple implementation of `is_empty` method for BufReader so it is possible to tell whether there is any data in its buffer. I didn't know correct stability annotation to place on the function. Presumably there is no reason to place this feature behind a feature flag, but I wasn't sure how to tag it as an unstable feature without that. CC: #45323
2017-11-01Rollup merge of #45664 - mbrubeck:docs, r=estebankkennytm-4/+5
Fix incorrect error type in Read::byte docs None
2017-10-31Fix incorrect error type in Read::byte docsMatt Brubeck-4/+5
2017-10-31Add a hint what `BufRead` functions do on EOFTobias Bucher-0/+4
2017-10-18Implement is_empty() for BufReaderJonathan Behrens-0/+25
2017-10-07Add read_to_end implementation to &[u8]'s Read implFlorian Hartwig-0/+8
The default impl for read_to_end does a bunch of bookkeeping that isn't necessary for slices and is about 4 times slower on my machine.
2017-09-23Rollup merge of #44712 - oconnor663:copy_test, r=GuillaumeGomezCorey Farwell-1/+2
fix an incorrect assertion in the doc example for `std::io::copy` I think this wasn't caught by CI because the `foo` wrapper function was only defined and not called. This seems to be the norm for doc examples that define a `foo` function. Is that on purpose?
2017-09-20fix an incorrect assertion in the doc example for `std::io::copy`Jack O'Connor-1/+2
2017-09-19Add some missing links in io docsGuillaume Gomez-4/+6
2017-09-01Fix testsNick Cameron-1/+1
This is just undoing changes from #41991 because we are not running markdown rendering twice.
2017-08-30Temporary fix for a test (will require another update when this is fully merged)Guillaume Gomez-1/+1
2017-08-24Fix inconsistent doc headingslukaramu-2/+2
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.
2017-08-21Add missing links for Read traitGuillaume Gomez-41/+65
2017-08-17Fix typo in docadrian5-1/+1
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-4/+4
Like #43008 (f668999), but _much more aggressive_.
2017-08-10Add missing links for Error docsGuillaume Gomez-1/+4
2017-08-10Add missing links in io module docsGuillaume Gomez-4/+6
2017-08-10Add missing links in io::Error docsGuillaume Gomez-7/+11
2017-08-02Fixed errors in libstd.Isaac van Bakel-1/+1
2017-07-20Remove mut where possibleEvan Cameron-10/+10
2017-07-12Rollup merge of #43136 - jgallag88:bufWriterDocs, r=steveklabnikMark Simulacrum-1/+5
Add warning to BufWriter documentation When using `BufWriter`, it is very easy to unintentionally ignore errors, because errors which occur when flushing buffered data when the `BufWriter` is dropped are ignored. This has been noted in a couple places: #32677, #37045. There has been some discussion about how to fix this problem in #32677, but no solution seems likely to land in the near future. For now, anyone who wishes to have robust error handling must remember to manually call `flush()` on a `BufWriter` before it is dropped. Until a permanent fix is in place, it seems worthwhile to add a warning to that effect to the documentation.
2017-07-11Allow setting the limit on std::io::Take.Mark Simulacrum-0/+29
2017-07-09Add warning to BufWriter documentationJohn Gallagher-1/+5
2017-06-30Stabilize 'more_io_inner_methods' feature.Sergio Benitez-15/+5
2017-06-20Add `Read::initializer`.Steven Fackler-40/+183
This is an API that allows types to indicate that they can be passed buffers of uninitialized memory which can improve performance.
2017-06-16Rollup merge of #42685 - Havvy:doc-remove-sometimes, r=steveklabnikCorey Farwell-1/+1
Remove sometimes in std::io::Read doc We use it immediately in the next sentence, and the word is filler. A different conversation to make is whether we want to call them Readers in the documentation at all. And whether it's actually called "Readers" elsewhere.
2017-06-15Update older URLs pointing to the first edition of the BookWonwoo Choi-1/+1
`compiler-plugins.html` is moved into the Unstable Book. Explanation is slightly modified to match the change.
2017-06-13Remove sometimes in std::io::Read docHavvy-1/+1
We use it immediately in the next sentence, and the word is filler.
2017-06-04inline io::Error creation from ErrorKindarthurprs-0/+1
2017-05-10Fix up stability annotations per feedback.Zack Weinberg-5/+5
2017-05-10Revise the eprint(ln)! feature.Zack Weinberg-51/+30
* 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/+38
These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout. Issue #39228.
2017-04-25Rollup merge of #41463 - SergioBenitez:master, r=alexcrichtonCorey Farwell-0/+139
Add internal accessor methods to io::{Chain, Take}. Resolves #29067.
2017-04-24Add cautions to io::get_mut method documentation.Sergio Benitez-0/+8
2017-04-24Reference tracking issue for more_io_inner_methods.Sergio Benitez-5/+5
2017-04-24Add internal accessor methods to io::{Chain, Take}.Sergio Benitez-0/+131
Resolves #29067.
2017-04-21Specify behavior of `write_all` for `ErrorKind::Interrupted` errorsTobias Bucher-6/+16
Also spell out that read and write operations should be retried on `ErrorKind::Interrupted` errors. Fixes #38494.
2017-04-06Fix Markdown issues in the docsOliver Middleton-12/+14
* Since the switch to pulldown-cmark reference links need a blank line before the URLs. * Reference link references are not case sensitive. * Doc comments need to be indented uniformly otherwise rustdoc gets confused.
2017-03-31Rollup merge of #40763 - pirate:patch-2, r=steveklabnikCorey Farwell-0/+12
Add helpful hint in io docs about how ? is not allowed in main() This is my effort to help alleviate the confusion caused by the error message: ```rust error[E0277]: the trait bound `(): std::ops::Carrier` is not satisfied --> hello_world.rs:72:5 | 72 | io::stdin().read_line(&mut d_input)?; | ------------------------------------ | | | the trait `std::ops::Carrier` is not implemented for `()` | in this macro invocation | = note: required by `std::ops::Carrier::from_error` error: aborting due to previous error ``` This has been discussed at length in https://github.com/rust-lang/rust/issues/35946, but I figured it would be helpful to mention in the docs. Reading user input is one of the first things beginners will look up in the docs, so my thinking was they'd see this warning here and not have to deal with the [tricky error message](https://blog.rust-lang.org/2017/03/02/lang-ergonomics.html). If you think this isn't the right place to put this in the docs, that's understandable, I'm open to suggestions for putting it elsewhere or removing it entirely.
2017-03-28Rollup merge of #40783 - stepancheg:cursor-new-0, r=aturonCorey Farwell-0/+4
Document Cursor::new position is 0 ... even if contained `Vec` is not empty. E. g. for ``` let v = vec![10u8, 20]; let mut c = io::Cursor::new(v); c.write_all(b"aaaa").unwrap(); println!("{:?}", c.into_inner()); ``` result is ``` [97, 97, 97, 97] ``` and not ``` [10, 20, 97, 97, 97, 97] ```
2017-03-28add missing importNick Sweeting-0/+2
2017-03-27Fix tidy errors and simplify exampleNick Sweeting-8/+6
2017-03-23Rewrite `io::BufRead` doc examples to better demonstrate behaviors.Corey Farwell-53/+84
Prior to this commit, most of the `BufRead` examples used `StdinLock` to demonstrate how certain `BufRead` methods worked. Using `StdinLock` is not ideal since: * Relying on run-time data means we can't show concrete examples of how these methods work up-front. The user is required to run them in order to see how they behave. * If the user tries to run an example in the playpen, it won't work because the playpen doesn't support user input to stdin.
2017-03-24Document Cursor::new position is 0Stepan Koltsov-0/+4
... even if contained `Vec` is not empty. E. g. for ``` let v = vec![10u8, 20]; let mut c = io::Cursor::new(v); c.write_all(b"aaaa").unwrap(); println!("{:?}", c.into_inner()); ``` result is ``` [97, 97, 97, 97] ``` and not ``` [10, 20, 97, 97, 97, 97] ```
2017-03-23newline for breathing roomNick Sweeting-0/+1
2017-03-23requested changesNick Sweeting-1/+2
2017-03-23Add helpful hint on io function for beginnersNick Sweeting-0/+10
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-53/+53
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