Commit Graph

985 Commits

Author SHA1 Message Date
Steve Klabnik
a39a36aec9 Rollup merge of #27170 - steveklabnik:doc_std_io_intoinnererror, r=alexcrichton
Mostly adding examples.

r? @alexcrichton
2015-07-22 12:56:51 -04:00
Steve Klabnik
932f0bb5c3 Rollup merge of #27167 - steveklabnik:doc_std_io_take, r=alexcrichton
Better and more consistent links to their creators.
2015-07-22 12:56:51 -04:00
Steve Klabnik
6397ecb3ca Rollup merge of #27166 - steveklabnik:doc_std_io_linewriter, r=alexcrichton
Beef up the struct docs, add examples for the methods.

r? @alexcrichton
2015-07-22 12:56:51 -04:00
Steve Klabnik
47f1286d56 Rollup merge of #27164 - steveklabnik:doc_io_utils, r=alexcrichton
These provide various special readers, so point their docs to their
constructor functions in a manner consistent with everything else.

r? @alexcrichton
2015-07-22 12:56:50 -04:00
Steve Klabnik
cc60f3f472 Rollup merge of #27163 - steveklabnik:doc_std_io_cursor, r=alexcrichton
Beef up the docs on the type, as well as adding examples for all
methods.

r? @alexcrichton
2015-07-22 12:56:50 -04:00
Steve Klabnik
558008b0f0 Rollup merge of #27157 - steveklabnik:doc_std_io_iterators, r=alexcrichton
Make them all consistent and link up the documentation.

r? @alexcrichton
2015-07-22 12:56:50 -04:00
Steve Klabnik
239657c377 Rollup merge of #27155 - steveklabnik:doc_std_io_buf_writer, r=alexcrichton
Mostly through adding examples.

r? @alexcrichton 

I'm going to be doing a bunch of these today, but I figured I'd keep it one PR per struct, since the last 'all the things in one PR' ended up taking a week to actually land.
2015-07-22 12:56:49 -04:00
Steve Klabnik
103749d933 Improve documentation for std::io::Cursor
Beef up the docs on the type, as well as adding examples for all
methods.
2015-07-22 11:42:59 -04:00
Steve Klabnik
e31ad959cc Improve documentation for std::io::LineWriter
Beef up the struct docs, add examples for the methods.
2015-07-22 10:19:36 -04:00
Steve Klabnik
e22c6f7caa Improve documentation for std::io::BufWriter
Mostly through adding examples.
2015-07-22 01:21:17 -04:00
Steve Klabnik
d2aee954fe Expand documentation for IntoInnerError
Mostly adding examples.
2015-07-21 13:37:09 -04:00
Steve Klabnik
fa28192312 Write better docs for std::io
This is the landing page for all of io, so we should have more than just
a sentence here.
2015-07-20 18:07:35 -04:00
Steve Klabnik
9e18326291 Update docs for take and broadcast
Better and more consistent links to their creators.
2015-07-20 16:47:58 -04:00
Steve Klabnik
7e7ec6b5cd Document structures in std::io::utils
These provide various special readers, so point their docs to their
constructor functions in a manner consistent with everything else.
2015-07-20 15:45:48 -04:00
Steve Klabnik
27fc0f21c4 Document iterators in std::io
Make them all consistent and link up the documentation.
2015-07-20 13:16:57 -04:00
Steve Klabnik
48ddf90682 Merge branch 'doc_io_traits_enums' of https://github.com/steveklabnik/rust into rollup_central 2015-07-16 17:54:44 -04:00
Steve Klabnik
4fb02a391d More docs for std::io free functions. 2015-07-16 13:38:20 -04:00
Steve Klabnik
664449ac6e More docs for std::io::Write 2015-07-16 13:38:16 -04:00
Steve Klabnik
092f4ed2de More docs for std::io::Seek 2015-07-16 13:38:15 -04:00
Steve Klabnik
ff664f3c6c More docs for std::io::Read 2015-07-16 13:38:11 -04:00
Steve Klabnik
2074b19bdc More docs for std::io::BufRead 2015-07-16 13:38:07 -04:00
Alisdair Owens
98f287240f Add specializations of read_to_end for Stdin, TcpStream and File,
allowing them to read into a buffer containing uninitialized data,
rather than pay the cost of zeroing.
2015-07-15 21:30:18 +01:00
bors
e4e93196e1 Auto merge of #27024 - bluss:io-drain, r=alexcrichton
Use Vec::drain in BufWriter

I happened past a comment that asked for functionality that we now have.
2015-07-14 11:13:21 +00:00
Ulrik Sverdrup
7b51c1c573 Use Vec::drain in BufWriter
I happened past a comment that asked for functionality that we now have.
2015-07-14 11:43:24 +02:00
Tshepang Lekhonkhobe
a458d46ea5 doc: remove redundant info
- It is clear that what follows are re-exports
- There aren't so many re-exports that examples should be given
2015-07-12 00:51:07 +02:00
bors
f7f28c8b26 Auto merge of #26903 - steveklabnik:io_function_docs, r=alexcricthon
This round: io::Result and the free functions.
2015-07-11 04:44:55 +00:00
Steve Klabnik
18201d7db1 More docs for std::io::BufReader 2015-07-10 16:47:48 -04:00
Steve Klabnik
1239e34261 Add more std::io documentation.
This round: io::Result and the free functions.
2015-07-10 10:24:11 -04:00
bors
f11502cda8 Auto merge of #26904 - bluss:no-repeat, r=alexcrichton
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-09 10:36:41 +00:00
Ulrik Sverdrup
5b6a464358 io: Use Vec::resize in Cursor<Vec<u8>> for more efficient zero fill
Vec::resize compiles to better code than .extend(repeat(0).take(n)) does
right now.
2015-07-09 01:18:29 +02:00
bors
020d201a66 Auto merge of #26849 - bluss:read-to-end-memset, r=alexcrichton
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-08 21:12:54 +00:00
Ulrik Sverdrup
a5cc17adaa io: Simplify BufReader::with_capacity
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-08 19:40:40 +02:00
Ulrik Sverdrup
6ac0ba3c3a Improve Vec::resize so that it can be used in 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-08 19:40:40 +02:00
Georg Brandl
df73abedd5 std: small doc fixes for BufReader and BufWriter
* fix probable copy-paste error in BufWriter.get_mut()
* more consistent punctuation
2015-07-05 11:59:33 +02:00
Tshepang Lekhonkhobe
bc1b43cd0b doc: add example for Stdin::read_line 2015-06-30 19:53:05 +02:00
bors
e749f724b0 Auto merge of #26514 - tshepang:repetition, r=Gankro 2015-06-23 02:32:44 +00:00
Tshepang Lekhonkhobe
4ce7901a5a doc: remove repeated word 2015-06-23 02:48:37 +02:00
Peter Atashian
c8aec53db7 Add a test for Debug for io::Error
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-06-19 12:55:59 -04:00
Peter Atashian
9a6b611a07 Custom Debug impl for io::Error
Fixes #26408

Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-06-18 22:16:46 -04:00
Alex Crichton
b4a2823cd6 More test fixes and fallout of stability changes 2015-06-17 09:07:17 -07:00
Alex Crichton
0d818b4ee4 std: Deprecate the io::BufStream type
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-17 09:07:16 -07:00
Alex Crichton
6895311e85 std: Split the std_misc feature 2015-06-17 09:06:59 -07:00
bors
7517ecf4fc Auto merge of #26168 - sfackler:stdout-panic, r=alexcrichton
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-15 06:44:42 +00:00
Steven Fackler
a7bbd7da4e Implement RFC 1014
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-14 20:17:06 -07:00
Joshua Landau
ca7418b846 Removed many pointless calls to *iter() and iter_mut() 2015-06-10 21:14:03 +01:00
Mikhail Zabaluev
0ad019f4e8 std::io: bump the stability tag on ErrorKind::InvalidData to 1.2.0 2015-05-30 15:09:13 +03:00
Mikhail Zabaluev
1d67cef6d2 std::io: New ErrorKind value InvalidData
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-29 22:23:46 +03:00
Steven Fackler
aebf331431 Mention UFCS sadness in instability messages 2015-05-28 10:34:40 -07:00
Steven Fackler
f65ba38cc4 Add a test for downcasting
Ergonomics are a bit crappy right now because method resolution isn't
smart enough to drop bounds, unfortunately.
2015-05-27 23:03:04 -07:00
Steven Fackler
b529a7837b Add accessors for io::Error's inner error.
error::Error itself has downcasting methods, so there's no need to
duplicate those here.
2015-05-27 21:53:54 -07:00