Merge rust-bitcoin/rust-bitcoin#1391: `Witness` conversion trait implementations
f0e72dbbfe
`Witness` conversion trait impls (Noah Lanson) Pull request description: #1385 Implemented: - `From<Vec<Vec<u8>>>` - `From<&[&[u8]]>` - `From<&[Vec<u8>]>` - `From<Vec<&[u8]>>` ACKs for top commit: tcharding: ACKf0e72dbbfe
Kixunil: ACKf0e72dbbfe
apoelstra: ACKf0e72dbbfe
Tree-SHA512: 87e52c62fb76dc41b9b26cc3faf0046598219b7737287961665ccce006e466ca3616b757b3eeff310127c10c1685d2fd897cfc035f1b4acc1fb48ed963e45930
This commit is contained in:
commit
b4a9a7a72a
|
@ -457,6 +457,30 @@ impl<'de> serde::Deserialize<'de> for Witness {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<Vec<Vec<u8>>> for Witness {
|
||||||
|
fn from(vec: Vec<Vec<u8>>) -> Self {
|
||||||
|
Witness::from_slice(&vec)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&[&[u8]]> for Witness {
|
||||||
|
fn from(slice: &[&[u8]]) -> Self {
|
||||||
|
Witness::from_slice(slice)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&[Vec<u8>]> for Witness {
|
||||||
|
fn from(slice: &[Vec<u8>]) -> Self {
|
||||||
|
Witness::from_slice(slice)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<Vec<&[u8]>> for Witness {
|
||||||
|
fn from(vec: Vec<&[u8]>) -> Self {
|
||||||
|
Witness::from_slice(&vec)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in New Issue