This repository was archived by the owner on Nov 30, 2022. It is now read-only.
Commit 3914d91
committed
Merge #156: Introduce HexWriter
7e79628 Introduce HexWriter (Riccardo Casatta)
Pull request description:
This struct create an hex string from a writer, in cases where you have
an encodable object this allows skipping the creation of the intermediate `Vec<u8>`
Useful in rust_bitcoin `serialize_hex` https://github.com/rust-bitcoin/rust-bitcoin/blob/0e82376bf85137494ff220608e80b9c78c1932b5/src/consensus/encode.rs#L149 but needs rust-bitcoin/rust-bitcoin#1027 so that result string size is known ahead of time
```
test hex::benches::bench_to_hex ... bench: 2,669 ns/iter (+/- 233)
test hex::benches::bench_to_hex_writer ... bench: 2,034 ns/iter (+/- 167)
```
ACKs for top commit:
apoelstra:
ACK 7e79628
tcharding:
ACK 7e79628
Tree-SHA512: 349c878fb31a1a41a83967434b33051f2b47db8133086204b965e7de1e5a663b16bb4c395cb308f5742fcf1d4ba2d3d0e41df105050c6a5b66022dd03046c9411 file changed
+84
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
222 | 267 | | |
223 | 268 | | |
224 | 269 | | |
| |||
276 | 321 | | |
277 | 322 | | |
278 | 323 | | |
| 324 | + | |
279 | 325 | | |
280 | 326 | | |
281 | 327 | | |
| |||
398 | 444 | | |
399 | 445 | | |
400 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
401 | 456 | | |
402 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
0 commit comments