Skip to content

Commit

Permalink
Add into_inner function for ConstraintSystemRef<F> (#347)
Browse files Browse the repository at this point in the history
Co-authored-by: Weikeng Chen <[email protected]>
Co-authored-by: Pratyush Mishra <[email protected]>
  • Loading branch information
3 people authored Apr 11, 2021
1 parent e9496ff commit b7b1b73
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## Pending

### Breaking changes

### Features
- [\#347](https://github.com/arkworks-rs/snark/pull/347) Add `into_inner` function for `ConstraintSystemRef<F>`.

### Improvements

### Bug fixes


## v0.2.0

### Breaking changes
Expand Down
10 changes: 10 additions & 0 deletions relations/src/r1cs/constraint_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,16 @@ impl<F: Field> ConstraintSystemRef<F> {
}
}

/// Consumes self to return the inner `ConstraintSystem<F>`. Returns
/// `None` if `Self::CS` is `None` or if any other references to
/// `Self::CS` exist.
pub fn into_inner(self) -> Option<ConstraintSystem<F>> {
match self {
Self::CS(a) => Rc::try_unwrap(a).ok().map(|s| s.into_inner()),
Self::None => None,
}
}

/// Obtain an immutable reference to the underlying `ConstraintSystem`.
///
/// # Panics
Expand Down

0 comments on commit b7b1b73

Please sign in to comment.