impl ToBytesGadget for Vec<UInt8> (#76)

This commit is contained in:
Pratyush Mishra
2021-07-12 12:04:22 -07:00
committed by GitHub
parent 6e59e02a1b
commit 65faa3e699
2 changed files with 8 additions and 0 deletions

View File

@@ -6,6 +6,8 @@
### Features
- [\#76](https://github.com/arkworks-rs/r1cs-std/pull/76) Implement `ToBytesGadget` for `Vec<UInt8>`.
### Improvements
### Bug Fixes

View File

@@ -116,6 +116,12 @@ impl<F: Field> ToBytesGadget<F> for [UInt8<F>] {
}
}
impl<F: Field> ToBytesGadget<F> for Vec<UInt8<F>> {
fn to_bytes(&self) -> Result<Vec<UInt8<F>>, SynthesisError> {
Ok(self.clone())
}
}
impl<'a, F: Field, T: 'a + ToBytesGadget<F>> ToBytesGadget<F> for &'a T {
fn to_bytes(&self) -> Result<Vec<UInt8<F>>, SynthesisError> {
(*self).to_bytes()