From f0e72dbbfe4b54d1f938dbae244c4fccbb7899f5 Mon Sep 17 00:00:00 2001 From: Noah Lanson Date: Tue, 15 Nov 2022 11:54:37 +1100 Subject: [PATCH] `Witness` conversion trait impls --- bitcoin/src/blockdata/witness.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs index b4776adf..8a416c86 100644 --- a/bitcoin/src/blockdata/witness.rs +++ b/bitcoin/src/blockdata/witness.rs @@ -457,6 +457,30 @@ impl<'de> serde::Deserialize<'de> for Witness { } } +impl From>> for Witness { + fn from(vec: Vec>) -> Self { + Witness::from_slice(&vec) + } +} + +impl From<&[&[u8]]> for Witness { + fn from(slice: &[&[u8]]) -> Self { + Witness::from_slice(slice) + } +} + +impl From<&[Vec]> for Witness { + fn from(slice: &[Vec]) -> Self { + Witness::from_slice(slice) + } +} + +impl From> for Witness { + fn from(vec: Vec<&[u8]>) -> Self { + Witness::from_slice(&vec) + } +} + #[cfg(test)] mod test { use super::*;