Browse Source

`impl ToBytesGadget for Vec<UInt8>` (#76)

master
Pratyush Mishra 3 years ago
committed by GitHub
parent
commit
65faa3e699
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions
  1. +2
    -0
      CHANGELOG.md
  2. +6
    -0
      src/bits/mod.rs

+ 2
- 0
CHANGELOG.md

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

+ 6
- 0
src/bits/mod.rs

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

Loading…
Cancel
Save