Commit 083230f
committed
Merge rust-bitcoin#5030: Add decoder I/O drivers
0ac8e91 consensus_encoding: API update (Nick Johnson)
93a085b consensus_encoding: add read interface for decoders (Nick Johnson)
9fb668e consensus_encoding: add decoder I/O drivers (Nick Johnson)
Pull request description:
Getting the ball rolling on I/O drivers for the decode side, which I think is going to be more interesting than the encode side since the buffered interface is different.
## First Patch
The simple drivers for slice and bufreader.
These are water'd down versions of push_decode. Some simplifications were made like making `ReadError` less generic by hard-coding to the std::io error type.
But this does get right to the chase for the decode-side complexity: is it cool to have a separate driver for `BufReader` and `Read`?
## Second Patch
The complex driver for `Read`.
Following push_decode's design, introduced a new requirement on the `Decoder`'s to expose a `min_bytes_needed`. This allows the read driver to efficiently manage its internal buffer. I just put this requirement straight on `Decoder` because I think we can assume all bitcoin decodables will know their min bytes.
ACKs for top commit:
tcharding:
ACK 0ac8e91
apoelstra:
ACK 0ac8e91; successfully ran local tests
Tree-SHA512: da5b0ca57e07338db11a1db73370bd21fe06ae699e971f3184780fd5dd7707b8992ea0b2d8a0944e25ebc047c4d93344b16388bace917b009e5007bdd0ef8fedFile tree
10 files changed
+401
-1
lines changed- api/units
- consensus_encoding
- src
- decode
- tests
- units/src
- amount
- locktime/absolute
10 files changed
+401
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1893 | 1893 | | |
1894 | 1894 | | |
1895 | 1895 | | |
| 1896 | + | |
1896 | 1897 | | |
1897 | 1898 | | |
1898 | 1899 | | |
| |||
2004 | 2005 | | |
2005 | 2006 | | |
2006 | 2007 | | |
| 2008 | + | |
2007 | 2009 | | |
2008 | 2010 | | |
2009 | 2011 | | |
| |||
2153 | 2155 | | |
2154 | 2156 | | |
2155 | 2157 | | |
| 2158 | + | |
2156 | 2159 | | |
2157 | 2160 | | |
2158 | 2161 | | |
| |||
2418 | 2421 | | |
2419 | 2422 | | |
2420 | 2423 | | |
| 2424 | + | |
2421 | 2425 | | |
2422 | 2426 | | |
2423 | 2427 | | |
| |||
2429 | 2433 | | |
2430 | 2434 | | |
2431 | 2435 | | |
| 2436 | + | |
2432 | 2437 | | |
2433 | 2438 | | |
2434 | 2439 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
168 | 182 | | |
169 | 183 | | |
170 | 184 | | |
| |||
215 | 229 | | |
216 | 230 | | |
217 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
218 | 235 | | |
219 | 236 | | |
220 | 237 | | |
| |||
268 | 285 | | |
269 | 286 | | |
270 | 287 | | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
271 | 291 | | |
272 | 292 | | |
273 | 293 | | |
| |||
346 | 366 | | |
347 | 367 | | |
348 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
349 | 372 | | |
350 | 373 | | |
351 | 374 | | |
| |||
0 commit comments