Taiki Endo
93b6d9e086
libstd => 2018
2019-02-28 04:06:15 +09:00
bors
fb162e6944
Auto merge of #58357 - sfackler:vectored-io, r=alexcrichton
...
Add vectored read and write support
This functionality has lived for a while in the tokio ecosystem, where
it can improve performance by minimizing copies.
r? @alexcrichton
2019-02-26 02:48:13 +00:00
kennytm
e3a8f7db47
Rollup merge of #58553 - scottmcm:more-ihle, r=Centril
...
Use more impl header lifetime elision
Inspired by seeing explicit lifetimes on these two:
- https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator
- https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not
And a follow-up to https://github.com/rust-lang/rust/pull/54687 , that started using IHLE in libcore.
Most of the changes in here fall into two big categories:
- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`)
- Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`)
I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm ).
I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-20 11:59:10 +08:00
Scott McMurray
3bea2ca49d
Use more impl header lifetime elision
...
There are two big categories of changes in here
- Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`)
- Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`)
I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-17 19:42:36 -08:00
Steven Fackler
596f18201c
impl Deref/DerefMut for IoVec types
...
Returning &'a mut [u8] was unsound, and we may as well just have them
directly deref to their slices to make it easier to work with them.
2019-02-13 19:40:17 -08:00
Steven Fackler
31bcec648a
Add vectored read and write support
...
This functionality has lived for a while in the tokio ecosystem, where
it can improve performance by minimizing copies.
2019-02-13 19:40:17 -08:00
Alexander Regueiro
b87363e763
tests: doc comments
2019-02-10 23:42:32 +00:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
Andy Russell
82e55c1bdc
deny intra-doc link resolution failures in libstd
2018-12-17 21:10:24 -05:00
Corey Farwell
c025d61409
Replace usages of ..i + 1
ranges with ..=i
.
2018-12-04 12:05:19 -08:00
Jonathan Behrens
59a030916b
Fix compile errors in test
2018-11-02 13:39:56 -04:00
Jonathan Behrens
40e41440e4
Suggested edits
2018-11-02 13:39:56 -04:00
Jonathan Behrens
07d966dbb8
Add some tests
2018-11-02 13:39:56 -04:00
Jonathan Behrens
7eece4771b
Add BufWriter::buffer method
2018-11-02 13:39:56 -04:00
Guillaume Gomez
c1ad1b0338
Fix invalid urls
2018-09-06 23:32:30 +02:00
Matthias Krüger
71120ef1e5
Fix typos found by codespell.
2018-08-19 17:41:28 +02:00
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