Age | Commit message (Collapse) | Author |
|
|
|
- If the internal buffer has some data, process that before reading
more.
|
|
- On debug builds, Vec<u8>::truncate is very, very slow. For
instance, running the decrypt_test_stream test takes 51 seconds on
my (Neal's) computer using Vec<u8>::truncate and <0.1 seconds using
`unsafe { v.set_len(len); }`.
The issue is that the compiler calls drop on every element that is
dropped, even though a u8 doesn't have a drop implementation. The
compiler optimizes this away at high optimization levels, but
those levels make debugging harder.
|
|
- The `Generic::data_helper` was not sufficiently careful when
dealing with errors. In particular:
- If `Generic::data_hard(1)` was called, and an error occured, and
nothing was buffered or read, `Generic::data_helper` would
return the empty string instead of the error.
- If `Generic::data(n)` was called, and an error occured, but some
data (< n bytes) was buffered, `Generic::data_helper` would
return the error instead of the data that was read.
- Fix these bugs.
- Also, simplify the code and don't save whether we hit EOF or the
error (which we can only return once, anyway). Instead, rely on
the underlying reader to return EOF or the error again.
- Fixes #174.
|
|
- Change BufferedReader::drop_through to optionally match EOF.
|
|
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
|
|
|
Newer Rust compilers requre `dyn` marking trait objects.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
|
|
|
|
|
|
- This is the result of running `cargo fix --edition`, with some
manual adjustments.
- The vast majority of changes merely qualify module paths with
'crate::'.
- Two instances of adding an anonymous pattern to a trait's
function.
- `async` is a keyword in Rust 2018, and hence it needs to be
escaped (e.g. in the case of the net::r#async module).
- The manual adjustments were needed due to various shortcomings of
the analysis employed by `cargo fix`, e.g. unexpanded macros,
procedural macros, lalrpop grammars.
|
|
|
|
|
|
- Fixes #237.
|
|
|
|
|
|
- Add convenience methods to the BufferReader trait to drop data
until some byte is encountered (BufferedReader::drop_until and
BufferedReader::drop_through).
|
|
- Also bump rfc2822 to 0.6.0. After all, we create tags for the
versions.
|
|
|
|
|
|
|
|
- Previously, if the underlying reader returned less data than
'amount', the limit would still be reduced by 'amount'.
|
|
|
|
|
|
|
|
- For example, `buffered_reader::BufferedReaderMemory` is now called
`buffered_reader::Memory`. This makes the type names less unwieldy.
- Fixes #206.
|
|
- According to the BufferedReader interface it is okay to return
short reads on `BufferedReader::data_consume()`.
- If `BufferedReader::data_consume_hard()` is called, return
UnexpectedEof instead of panicking.
- Fixes #207.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Also, update BufferedReaders to implement it.
|
|
|
|
- If we get an EINTR while reading, automatically retry.
|
|
- Since it is possible to provide an efficient default
implementation of data_consume and data_consume_hard, we should do
so.
|
|
|
|
|
|
- Calling BufferedReaderGeneric::data_hard with amount greater than
0 on an empty file should return an error, not an empty buffer.
|
|
- BufferedReaders are often nested. Print the current reader's
state first and the inner reader last so that the debugging output
is more readable.
|
|
|
|
- This buffered reader prevents the reader from reading the last X
bytes of the underlying buffered reader.
|
|
- Fixes #98.
|
|
|
|
- New method BufferedReaderDup::rewind.
|
|
- This is useful for reading a line at a time.
|
|
|
|
|