You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge rust-bitcoin#5256: Add an iterator that yields the bytes of an encoded object
b7cb088 Add iterator tests for EncodableByteIter (Mitchell Bagot)
4fa296a Add an iterator to yield the bytes of an encoded object (Mitchell Bagot)
Pull request description:
The Encoder trait currently provides an iterator-style interface for objects to yield byte slices. Since other utilities, like hex::BytesToHexIter rely on byte-by-byte input to function, providing a method of yielding raw bytes for Encodables increases the versatility of the encoding on Encodable objects.
Add EncodableByteIter struct to iterate the bytes from an Encodable as u8 values, and tests to demonstrate function alongside hex::BytesToHexIter
Closesrust-bitcoin#5190
ACKs for top commit:
apoelstra:
ACK b7cb088; successfully ran local tests
tcharding:
ACK b7cb088
Tree-SHA512: f6cc2428ad0a452f17004b066799e33d401d83b4961ba85c806f84dc60238aa7d20f0c08c57571ca2ec3695a86e06d37e60e2b54dbba965218e1c9e396c8374c
Copy file name to clipboardExpand all lines: api/consensus_encoding/all-features.txt
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,14 @@ impl<'e, T> core::marker::Sync for bitcoin_consensus_encoding::SliceEncoder<'e,
87
87
impl<'e, T> core::marker::Unpin for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Unpin
88
88
impl<'e, T> core::panic::unwind_safe::RefUnwindSafe for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::RefUnwindSafe, T: core::panic::unwind_safe::RefUnwindSafe
89
89
impl<'e, T> core::panic::unwind_safe::UnwindSafe for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::UnwindSafe, T: core::panic::unwind_safe::RefUnwindSafe
impl<'s, T: bitcoin_consensus_encoding::Encodable + 's> core::iter::traits::iterator::Iterator for bitcoin_consensus_encoding::EncodableByteIter<'s, T>
92
+
impl<'s, T> core::marker::Freeze for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Freeze
93
+
impl<'s, T> core::marker::Send for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Send
94
+
impl<'s, T> core::marker::Sync for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Sync
95
+
impl<'s, T> core::marker::Unpin for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Unpin
96
+
impl<'s, T> core::panic::unwind_safe::RefUnwindSafe for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::RefUnwindSafe
97
+
impl<'s, T> core::panic::unwind_safe::UnwindSafe for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::UnwindSafe
@@ -445,5 +456,6 @@ pub type bitcoin_consensus_encoding::Decoder6<A, B, C, D, E, F>::Output = (<A as
445
456
pub type bitcoin_consensus_encoding::Decoder::Error
446
457
pub type bitcoin_consensus_encoding::Decoder::Output
447
458
pub type bitcoin_consensus_encoding::Encodable::Encoder<'s> where Self: 's: bitcoin_consensus_encoding::Encoder
459
+
pub type bitcoin_consensus_encoding::EncodableByteIter<'s, T>::Item = u8
448
460
pub type bitcoin_consensus_encoding::VecDecoder<T>::Error = bitcoin_consensus_encoding::VecDecoderError<<<T as bitcoin_consensus_encoding::Decodable>::Decoder as bitcoin_consensus_encoding::Decoder>::Error>
449
461
pub type bitcoin_consensus_encoding::VecDecoder<T>::Output = alloc::vec::Vec<T>
Copy file name to clipboardExpand all lines: api/consensus_encoding/alloc-only.txt
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -83,6 +83,14 @@ impl<'e, T> core::marker::Sync for bitcoin_consensus_encoding::SliceEncoder<'e,
83
83
impl<'e, T> core::marker::Unpin for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Unpin
84
84
impl<'e, T> core::panic::unwind_safe::RefUnwindSafe for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::RefUnwindSafe, T: core::panic::unwind_safe::RefUnwindSafe
85
85
impl<'e, T> core::panic::unwind_safe::UnwindSafe for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::UnwindSafe, T: core::panic::unwind_safe::RefUnwindSafe
impl<'s, T: bitcoin_consensus_encoding::Encodable + 's> core::iter::traits::iterator::Iterator for bitcoin_consensus_encoding::EncodableByteIter<'s, T>
88
+
impl<'s, T> core::marker::Freeze for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Freeze
89
+
impl<'s, T> core::marker::Send for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Send
90
+
impl<'s, T> core::marker::Sync for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Sync
91
+
impl<'s, T> core::marker::Unpin for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Unpin
92
+
impl<'s, T> core::panic::unwind_safe::RefUnwindSafe for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::RefUnwindSafe
93
+
impl<'s, T> core::panic::unwind_safe::UnwindSafe for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::UnwindSafe
@@ -410,5 +421,6 @@ pub type bitcoin_consensus_encoding::Decoder6<A, B, C, D, E, F>::Output = (<A as
410
421
pub type bitcoin_consensus_encoding::Decoder::Error
411
422
pub type bitcoin_consensus_encoding::Decoder::Output
412
423
pub type bitcoin_consensus_encoding::Encodable::Encoder<'s> where Self: 's: bitcoin_consensus_encoding::Encoder
424
+
pub type bitcoin_consensus_encoding::EncodableByteIter<'s, T>::Item = u8
413
425
pub type bitcoin_consensus_encoding::VecDecoder<T>::Error = bitcoin_consensus_encoding::VecDecoderError<<<T as bitcoin_consensus_encoding::Decodable>::Decoder as bitcoin_consensus_encoding::Decoder>::Error>
414
426
pub type bitcoin_consensus_encoding::VecDecoder<T>::Output = alloc::vec::Vec<T>
Copy file name to clipboardExpand all lines: api/consensus_encoding/no-features.txt
+12Lines changed: 12 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,14 @@ impl<'e, T> core::marker::Sync for bitcoin_consensus_encoding::SliceEncoder<'e,
49
49
impl<'e, T> core::marker::Unpin for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Unpin
50
50
impl<'e, T> core::panic::unwind_safe::RefUnwindSafe for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::RefUnwindSafe, T: core::panic::unwind_safe::RefUnwindSafe
51
51
impl<'e, T> core::panic::unwind_safe::UnwindSafe for bitcoin_consensus_encoding::SliceEncoder<'e, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::UnwindSafe, T: core::panic::unwind_safe::RefUnwindSafe
impl<'s, T: bitcoin_consensus_encoding::Encodable + 's> core::iter::traits::iterator::Iterator for bitcoin_consensus_encoding::EncodableByteIter<'s, T>
54
+
impl<'s, T> core::marker::Freeze for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Freeze
55
+
impl<'s, T> core::marker::Send for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Send
56
+
impl<'s, T> core::marker::Sync for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Sync
57
+
impl<'s, T> core::marker::Unpin for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::marker::Unpin
58
+
impl<'s, T> core::panic::unwind_safe::RefUnwindSafe for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::RefUnwindSafe
59
+
impl<'s, T> core::panic::unwind_safe::UnwindSafe for bitcoin_consensus_encoding::EncodableByteIter<'s, T> where <T as bitcoin_consensus_encoding::Encodable>::Encoder: core::panic::unwind_safe::UnwindSafe
0 commit comments