`Witness` conversion trait impls

This commit is contained in:
Noah Lanson 2022-11-15 11:54:37 +11:00
parent 60f3a19acd
commit f0e72dbbfe
1 changed files with 24 additions and 0 deletions

View File

@ -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::*;