Simon Sapin
4ca77f702f
Remove unstable and deprecated APIs
2018-07-30 18:18:23 +02:00
Jonathan Behrens
abb704ec78
State default capacity for BufReader/BufWriter
2018-07-26 00:49:35 +01:00
Andy Russell
c12a757424
simplify assertions
2018-07-11 14:39:22 -04:00
Andy Russell
a1e1b5c3fb
rework LineWriter
example
...
The original example didn't check the return value of `write()`, didn't
flush the writer, and didn't properly demonstrate the buffering.
Fixes #51621 .
2018-07-08 17:46:23 -04:00
Simon Sapin
7cbeddb7b7
Deprecate Read::chars and char::decode_utf8
...
Per FCP:
* https://github.com/rust-lang/rust/issues/27802#issuecomment-377537778
* https://github.com/rust-lang/rust/issues/33906#issuecomment-377534308
2018-04-15 08:18:00 +02:00
kennytm
93ad4f2b9c
Rollup merge of #49594 - mbrubeck:docs, r=steveklabnik
...
Add some performance guidance to std::fs and std::io docs
Adds more documentation about performance to various "read" functions in `fs` and `io`, and to `BufReader`/`BufWriter`, with the goal of helping developers choose the best option for a given task.
2018-04-05 02:17:03 +08:00
Matt Brubeck
390f8367e7
Add performance notes to BufReader/BufWriter docs
2018-04-03 15:25:55 -07:00
Rolf van de Krol
a2a0f21ba1
Fix typo
2018-04-02 21:48:56 +02:00
Corey Farwell
e9dcec070d
Remove hidden foo
functions from doc examples; use Termination
trait.
...
Fixes https://github.com/rust-lang/rust/issues/49233 .
2018-03-28 13:15:05 +02:00
Steven Fackler
16da5d4bb2
Add BufReader::buffer
...
This subsumes the need for an explicit is_empty function, and provides
access to the buffered data itself which has been requested from time to
time.
2018-03-18 13:14:29 -07:00
Matthias Krüger
4452446292
fix more typos found by codespell.
2018-02-17 17:38:49 +01:00
kennytm
6966f335ac
Rollup merge of #47330 - bmusin:patch-2, r=shepmaster
...
fix off-by-one error
Fixes https://github.com/rust-lang/rust/issues/47325 .
2018-01-15 18:49:33 +08:00
bors
80e2e67f4c
Auto merge of #46832 - Diggsey:bufread-cheaper-seek, r=alexcrichton
...
BufRead: Only flush the internal buffer if seeking outside of it.
Fixes #31100
r? @dtolnay
2018-01-14 00:42:11 +00:00
Diggory Blake
c96f30257a
Add note to documentation
2018-01-13 18:44:25 +00:00
Diggory Blake
562ba04e45
Implement "seek_relative"
2018-01-13 18:39:37 +00:00
Bulat Musin
cee295e8af
fix off-by-one error
2018-01-13 07:23:43 +03:00
Corey Farwell
f3ef077b91
Document when LineWriter flushes; document errors for into_inner.
...
Fixes https://github.com/rust-lang/rust/issues/42468 .
2018-01-02 13:30:44 -08:00
Trevor Spiteri
9d6bd0536a
docs: do not call integer overflows as underflows
2017-12-21 02:39:01 +01:00
Jonathan Behrens
df4b78160c
Implement is_empty() for BufReader
2017-10-18 14:27:33 -04:00
Zack M. Davis
1b6c9605e4
use field init shorthand EVERYWHERE
...
Like #43008 (f668999
), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Evan Cameron
72e8009185
Remove mut where possible
2017-07-20 13:59:44 -04:00
John Gallagher
c6b280e039
Add warning to BufWriter documentation
2017-07-09 17:59:59 -04:00
Steven Fackler
ecbb896b9e
Add Read::initializer
.
...
This is an API that allows types to indicate that they can be passed
buffers of uninitialized memory which can improve performance.
2017-06-20 20:26:22 -07:00
Oliver Middleton
b4be475836
Fix Markdown issues in the docs
...
* 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-04-06 12:57:40 +01:00
Utkarsh Kukreti
9d912b683a
libstd: replace all try!
with ?
in documentation examples
...
See #38644 .
2017-01-22 21:07:38 +05:30
Alex Crichton
ecc60106c9
std: Fix partial writes in LineWriter
...
Previously the `LineWriter` could successfully write some bytes but then fail to
report that it has done so. Additionally, an erroneous flush after a successful
write was permanently ignored. This commit fixes these two issues by (a)
maintaining a `need_flush` flag to indicate whether a flush should be the first
operation in `LineWriter::write` and (b) avoiding returning an error once some
bytes have been successfully written.
Closes #37807
2016-11-28 15:05:04 -08:00
Arthur Silva
dcd80b80ae
Remove one bounds check from BufReader
...
Otherwise the optimizer can't be sure that pos <= cap. Added a paranoid debug_assert to ensure correctness instead.
2016-11-10 22:26:50 +01:00
Jonathan Turner
67aaddddd6
Rollup merge of #37115 - GuillaumeGomez:buf_reader_urls, r=kmcallister
...
add missing urls for BufWriter and BufReader
r? @steveklabnik
2016-10-14 12:07:08 -07:00
Guillaume Gomez
96a8bae3da
add missing urls for BufWriter and BufReader
2016-10-12 18:27:04 +02:00
Nick Cameron
14c62f91b7
Deprecate Reflect
...
[tracking issue](https://github.com/rust-lang/rust/issues/27749 )
2016-10-12 08:40:22 +13:00
Razican
8d06332a27
Fixed small typo in BufRead
comments
...
`BufRead` comments, in the `Seek` trait implementation, was talking
about allocating 8 *ebibytes*. It was a typo, the correct unit is
*exbibytes*, since *ebibytes* don't even exist. The calculation is
correct, though.
2016-10-05 13:18:45 +02:00
Brian Anderson
9c4a01ee9e
Ignore lots and lots of std tests on emscripten
2016-09-30 14:02:48 -07:00
Christopher Serr
e107c8b849
Fix outdated Doc Comment on BufReader::seek
...
A long time ago non-panicking `unwrap` methods were renamed to `into_inner` in this Pull Request: https://github.com/rust-lang/rust/pull/19149
Looks like this doc comment was not updated however.
2016-09-21 21:11:53 +02:00
Richard Janis Goldschmidt
c8b656bea5
Remove unnecessary cmp::min
from BufWriter::write
...
The first branch of the if statement already checks if `buf.len() >= self.buf.capacity()`, which makes the `cmp::min(buf.len(), self.buf.capacity())` redundant: the result will always be `buf.len()`. Therefore, we can pass the `buf` slice directly into `Write::write`.
2016-09-11 16:48:04 +02:00
Jeffrey Seyfried
9a2c8783d9
Use #[prelude_import]
in libstd
.
2016-08-24 22:12:48 +00:00
Corey Farwell
62b19c627e
Utilize Result::unwrap_err
in more places.
2016-05-09 08:40:57 -04:00
Jorge Aparicio
0f02309e4b
try! -> ?
...
Automated conversion using the untry tool [1] and the following command:
```
$ find -name '*.rs' -type f | xargs untry
```
at the root of the Rust repo.
[1]: https://github.com/japaric/untry
2016-03-22 22:01:37 -05:00
Steven Allen
c516335815
Add test case for #32085
2016-03-07 18:00:22 -05:00
Steven Allen
6ea8222913
Never return an error after a partial write
...
If LineWriter fails to flush, return the number of bytes written instead
of an error.
Fixes #32085
2016-03-07 16:35:37 -05:00
Alex Crichton
cb343c33ac
Fix warnings during tests
...
The deny(warnings) attribute is now enabled for tests so we need to weed out
these warnings as well.
2016-01-26 09:29:28 -08:00
bors
00ee90f0f0
Auto merge of #31070 - sfackler:bufreader-box-slice, r=alexcrichton
...
Saves a word, and also prevents the impl from accidentally changing the
buffer length.
r? @alexcrichton
2016-01-22 06:04:50 +00:00
Steven Fackler
b740c557e2
Use a Box<[u8]> in BufReader
...
Saves a word, and also prevents the impl from accidentally changing the
buffer length.
2016-01-20 22:40:25 -08:00
Steven Fackler
334bee3489
Don't flush in BufWriter destructor after a panic in write
...
We don't want to write the same data twice.
Closes #30888
2016-01-20 22:30:46 -08:00
Andrea Canciani
fb82398b2a
Remove dead InternalBufWriter
implementation
...
In 8d90d3f368
`BufStream`, the only
consumer of `InternalBufWriter`, was removed. As implied by the name,
this type is private, hence it is currently dead code.
2016-01-12 18:10:43 +01:00
Florian Hahn
e27cbeff37
Fix warnings when compiling stdlib with --test
2015-12-29 16:07:01 +01:00
Florian Hahn
de3e843d24
Use memchr in libstd where possible, closes #30076
2015-12-18 13:32:14 +01:00
Vadim Petrochenkov
7e2ffc7090
Add missing annotations and some tests
2015-11-18 01:24:21 +03:00
Cristi Cobzarenco
4b308b44e1
typos: fix a grabbag of typos all over the place
2015-10-08 19:49:31 +01:00
Alex Crichton
8d90d3f368
Remove all unstable deprecated functionality
...
This commit removes all unstable and deprecated functions in the standard
library. A release was recently cut (1.3) which makes this a good time for some
spring cleaning of the deprecated functions.
2015-08-12 14:55:17 -07:00
Steve Klabnik
1406c196fd
Rollup merge of #27341 - steveklabnik:remove_warning, r=alexcrichton
...
This isn't a standard header, and the other docs don't use it, so let's remove it.
2015-07-29 10:30:35 -04:00