Merge rust-bitcoin/rust-bitcoin#1354: Add `impl IntoIterator for &'_ Witness`
d2ed0fe022
Add `impl IntoIterator for &'_ Witness` (Martin Habovstiak) Pull request description: It is considered idiomatic for types that have `iter()` method to also implement `IntoIterator` for their references. `Witness` was missing this so it is added here. ACKs for top commit: apoelstra: ACKd2ed0fe022
tcharding: ACKd2ed0fe022
Tree-SHA512: fc891109696de4f349324d6ddc160249ef22510622d9ce72a65b18f085d86b0de0f3ecb4f7060e1eaf716a908029865cd21cda5a6598fc4c16d0540152d9a4c9
This commit is contained in:
commit
d8e94cf181
|
@ -274,6 +274,15 @@ impl<'a> Iterator for Iter<'a> {
|
|||
|
||||
impl<'a> ExactSizeIterator for Iter<'a> {}
|
||||
|
||||
impl<'a> IntoIterator for &'a Witness {
|
||||
type IntoIter = Iter<'a>;
|
||||
type Item = &'a [u8];
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.iter()
|
||||
}
|
||||
}
|
||||
|
||||
// Serde keep backward compatibility with old Vec<Vec<u8>> format
|
||||
#[cfg(feature = "serde")]
|
||||
impl serde::Serialize for Witness {
|
||||
|
|
Loading…
Reference in New Issue