rust-bitcoin-unsafe-fast/internals/src
Steven Roose 18d8b0e469
Replace VarInt type with ReadExt and WriteExt functions
At some stage we named the compact encoding `VarInt` (which makes sense
because the compact size encoding is a variable length integer encoding).
However it turns out the term "varint" is used in Core for a different
encoding so this may lead to confusion.

While we fix this naming thing observe also that the `VarInt` type is
unnecessarily complicated, all we need to be able to do is encode and
decode integers in compact form as specified by Core. We can do this
simply by extending our `WriteExt` and `ReadExt` traits.

Add `emit_compact_size` and `read_compact_size` to emit and read compact
endcodings respectively.

Includes addition of `internals::compact_size::encoded_size_const`.

Patch originally written by Steven, Tobin cherry-picked and did a bunch
of impovements after the varint vs compact_size thing (#1016).

ref: https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer

Co-developed-by: Tobin C. Harding <me@tobin.cc>
2024-09-25 06:56:09 +10:00
..
error Link to std::error::Error 2024-06-14 14:00:58 +10:00
array_vec.rs Add unit test for ArrayVec::extend_from_slice 2024-08-30 09:14:43 +10:00
compact_size.rs Replace VarInt type with ReadExt and WriteExt functions 2024-09-25 06:56:09 +10:00
const_tools.rs Refactor Rust version checking 2024-08-19 15:21:01 +02:00
error.rs Removed //! spare line at end of headers 2024-05-22 12:23:57 +01:00
lib.rs Allow unused in `macros.rs` docs 2024-09-18 16:38:19 +01:00
macros.rs Allow unused in `macros.rs` docs 2024-09-18 16:38:19 +01:00
parse.rs Use full path in all macro usage of Result 2024-01-18 19:11:01 +01:00
script.rs Re-write (and re-name) read_uint_iter 2024-09-09 06:31:39 +10:00
serde.rs Change `T::from_str(s)` to `s.parse::<T>()` 2024-08-27 17:31:00 +01:00