about summary refs log tree commit diff
path: root/src/libstd/io
AgeCommit message (Collapse)AuthorLines
2015-07-12doc: remove redundant infoTshepang Lekhonkhobe-4/+0
- It is clear that what follows are re-exports - There aren't so many re-exports that examples should be given
2015-07-11Auto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthonbors-19/+158
This round: io::Result and the free functions.
2015-07-10More docs for std::io::BufReaderSteve Klabnik-4/+77
2015-07-10Add more std::io documentation.Steve Klabnik-19/+158
This round: io::Result and the free functions.
2015-07-09Auto merge of #26904 - bluss:no-repeat, r=alexcrichtonbors-2/+3
In a followup to PR #26849, improve one more location for I/O where we can use `Vec::resize` to ensure better performance when zeroing buffers. Use the `vec![elt; n]` macro everywhere we can in the tree. It replaces `repeat(elt).take(n).collect()` which is more verbose, requires type hints, and right now produces worse code. `vec![]` is preferable for vector initialization. The `vec![]` replacement touches upon one I/O path too, Stdin::read for windows, and that should be a small improvement. r? @alexcrichton
2015-07-09io: Use Vec::resize in Cursor<Vec<u8>> for more efficient zero fillUlrik Sverdrup-2/+3
Vec::resize compiles to better code than .extend(repeat(0).take(n)) does right now.
2015-07-08Auto merge of #26849 - bluss:read-to-end-memset, r=alexcrichtonbors-6/+11
Improve zerofill in Vec::resize and Read::read_to_end We needed a more efficient way to zerofill the vector in read_to_end. This to reduce the memory intialization overhead to a minimum. Use the implementation of `std::vec::from_elem` (used for the vec![] macro) for Vec::resize as well. For simple element types like u8, this compiles to memset, so it makes Vec::resize much more efficient.
2015-07-08io: Simplify BufReader::with_capacityUlrik Sverdrup-4/+1
Use the vec![] macro directly to create a sized, zeroed vector. This should result in a big speedup when creating BufReader, because vec![0; cap] compiles to a memset call, while the previous extend code currently did not.
2015-07-08Improve Vec::resize so that it can be used in Read::read_to_endUlrik Sverdrup-2/+10
We needed a more efficient way to zerofill the vector in read_to_end. This to reduce the memory intialization overhead to a minimum. Use the implementation of `std::vec::from_elem` (used for the vec![] macro) for Vec::resize as well. For simple element types like u8, this compiles to memset, so it makes Vec::resize much more efficient.
2015-07-05std: small doc fixes for BufReader and BufWriterGeorg Brandl-8/+8
* fix probable copy-paste error in BufWriter.get_mut() * more consistent punctuation
2015-06-30doc: add example for Stdin::read_lineTshepang Lekhonkhobe-0/+22
2015-06-23Auto merge of #26514 - tshepang:repetition, r=Gankrobors-1/+1
2015-06-23doc: remove repeated wordTshepang Lekhonkhobe-1/+1
2015-06-19Add a test for Debug for io::ErrorPeter Atashian-0/+10
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-06-18Custom Debug impl for io::ErrorPeter Atashian-1/+11
Fixes #26408 Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-06-17More test fixes and fallout of stability changesAlex Crichton-2/+6
2015-06-17std: Deprecate the io::BufStream typeAlex Crichton-0/+4
Questions about the utility of this type has caused it to move to crates.io in the `bufstream` crate, so this type can be deprecated.
2015-06-17std: Split the `std_misc` featureAlex Crichton-1/+1
2015-06-15Auto merge of #26168 - sfackler:stdout-panic, r=alexcrichtonbors-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-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-06-10Removed many pointless calls to *iter() and iter_mut()Joshua Landau-1/+1
2015-05-30std::io: bump the stability tag on ErrorKind::InvalidData to 1.2.0Mikhail Zabaluev-1/+1
2015-05-29std::io: New ErrorKind value InvalidDataMikhail Zabaluev-1/+8
This takes the cases from InvalidInput where a data format error was encountered. This is different from the documented semantics of InvalidInput, which more likely indicate a programming error.
2015-05-28Mention UFCS sadness in instability messagesSteven Fackler-3/+6
2015-05-27Add a test for downcastingSteven Fackler-2/+38
Ergonomics are a bit crappy right now because method resolution isn't smart enough to drop bounds, unfortunately.
2015-05-27Add accessors for io::Error's inner error.Steven Fackler-6/+42
error::Error itself has downcasting methods, so there's no need to duplicate those here.
2015-05-27Delegate io::Error::cause to inner errorSteven Fackler-0/+7
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-21/+20
2015-05-25doc: fix io::Write::write typoTshepang Lekhonkhobe-1/+1
2015-05-20doc: 'reader' and 'writer' are nicer to read than 'r' and 'w'Tshepang Lekhonkhobe-7/+8
2015-05-19Add example code and cross-link to BufReader docsMatt Brubeck-1/+22
2015-05-10Update docs to stop referencing `BufReadExt`Corey Farwell-2/+2
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-05-05Auto merge of #25009 - alexcrichton:less-buffered-stream, r=aturonbors-10/+18
As pointed out in #17136 the semantics of a `BufStream` aren't always what one expects, and it looks like other [languages like C#][c-sharp] implement a buffered stream with only one underlying buffer. For now this commit destabilizes the primitive in the `std::io` module to give us some more time in figuring out what to do with it. [c-sharp]: https://msdn.microsoft.com/en-us/library/system.io.bufferedstream%28v=vs.110%29.aspx [breaking-change]
2015-05-01Auto merge of #25006 - alexcrichton:unstable-indexing, r=aturonbors-3/+3
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791 [breaking-change]
2015-05-01std: Remove index notation on slice iteratorsAlex Crichton-3/+3
These implementations were intended to be unstable, but currently the stability attributes cannot handle a stable trait with an unstable `impl` block. This commit also audits the rest of the standard library for explicitly-`#[unstable]` impl blocks. No others were removed but some annotations were changed to `#[stable]` as they're defacto stable anyway. One particularly interesting `impl` marked `#[stable]` as part of this commit is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly clones all elements of the vector provided. Closes #24791
2015-05-01Rollup merge of #25021 - frewsxcv:an-utf, r=steveklabnikManish Goregaokar-1/+1
Even spelled out, one would say 'a Universal Character Set'
2015-04-30Replaces instanced of 'an UTF' with 'a UTF'Corey Farwell-1/+1
Even spelled out, one would say 'a Universal Character Set'
2015-04-30Add downcasting to std::error::ErrorAaron Turon-1/+2
This commit brings the `Error` trait in line with the [Error interoperation RFC](https://github.com/rust-lang/rfcs/pull/201) by adding downcasting, which has long been intended. This change means that for any `Error` trait objects that are `'static`, you can downcast to concrete error types. To make this work, it is necessary for `Error` to inherit from `Reflect` (which is currently used to mark concrete types as "permitted for reflection, aka downcasting"). This is a breaking change: it means that impls like ```rust impl<T> Error for MyErrorType<T> { ... } ``` must change to something like ```rust impl<T: Reflect> Error for MyErrorType<T> { ... } ``` except that `Reflect` is currently unstable (and should remain so for the time being). For now, code can instead bound by `Any`: ```rust impl<T: Any> Error for MyErrorType<T> { ... } ``` which *is* stable and has `Reflect` as a super trait. The downside is that this imposes a `'static` constraint, but that only constrains *when* `Error` is implemented -- it does not actually constrain the types that can implement `Error`. [breaking-change]
2015-04-30std: Destabilize io::BufStreamAlex Crichton-10/+18
As pointed out in #17136 the semantics of a `BufStream` aren't always what one expects, and it looks like other [languages like C#][c-sharp] implement a buffered stream with only one underlying buffer. For now this commit destabilizes the primitive in the `std::io` module to give us some more time in figuring out what to do with it. [c-sharp]: https://msdn.microsoft.com/en-us/library/system.io.bufferedstream%28v=vs.110%29.aspx [breaking-change]
2015-04-28Register new snapshotsTamir Duberstein-3/+1
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-2/+2
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-21std: Remove deprecated/unstable num functionalityAlex Crichton-7/+0
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-2/+0
2015-04-18Auto merge of #24428 - kwantam:deprecate_unicode_fns, r=alexcrichtonbors-1/+1
This patch 1. renames libunicode to librustc_unicode, 2. deprecates several pieces of libunicode (see below), and 3. removes references to deprecated functions from librustc_driver and libsyntax. This may change pretty-printed output from these modules in cases involving wide or combining characters used in filenames, identifiers, etc. The following functions are marked deprecated: 1. char.width() and str.width(): --> use unicode-width crate 2. str.graphemes() and str.grapheme_indices(): --> use unicode-segmentation crate 3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(), char.compose(), char.decompose_canonical(), char.decompose_compatible(), char.canonical_combining_class(): --> use unicode-normalization crate
2015-04-18Auto merge of #24133 - kballard:add-sync-to-io-error, r=alexcrichtonbors-3/+8
This allows `io::Error` values to be stored in `Arc` properly. Because this requires `Sync` of any value passed to `io::Error::new()` and modifies the relevant `convert::From` impls, this is a [breaking-change] Fixes #24049.
2015-04-16deprecate Unicode functions that will be moved to crates.iokwantam-1/+1
This patch 1. renames libunicode to librustc_unicode, 2. deprecates several pieces of libunicode (see below), and 3. removes references to deprecated functions from librustc_driver and libsyntax. This may change pretty-printed output from these modules in cases involving wide or combining characters used in filenames, identifiers, etc. The following functions are marked deprecated: 1. char.width() and str.width(): --> use unicode-width crate 2. str.graphemes() and str.grapheme_indices(): --> use unicode-segmentation crate 3. str.nfd_chars(), str.nfkd_chars(), str.nfc_chars(), str.nfkc_chars(), char.compose(), char.decompose_canonical(), char.decompose_compatible(), char.canonical_combining_class(): --> use unicode-normalization crate
2015-04-16Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichtonbors-1/+1
r? @alexcrichton
2015-04-15Fix some typos.Ms2ger-1/+1