Skip to content

Commit b7b1b73

Browse files
ryanlehweikengchenPratyush
authored
Add into_inner function for ConstraintSystemRef<F> (#347)
Co-authored-by: Weikeng Chen <[email protected]> Co-authored-by: Pratyush Mishra <[email protected]>
1 parent e9496ff commit b7b1b73

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## Pending
2+
3+
### Breaking changes
4+
5+
### Features
6+
- [\#347](https://github.com/arkworks-rs/snark/pull/347) Add `into_inner` function for `ConstraintSystemRef<F>`.
7+
8+
### Improvements
9+
10+
### Bug fixes
11+
12+
113
## v0.2.0
214

315
### Breaking changes

relations/src/r1cs/constraint_system.rs

+10
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,16 @@ impl<F: Field> ConstraintSystemRef<F> {
767767
}
768768
}
769769

770+
/// Consumes self to return the inner `ConstraintSystem<F>`. Returns
771+
/// `None` if `Self::CS` is `None` or if any other references to
772+
/// `Self::CS` exist.
773+
pub fn into_inner(self) -> Option<ConstraintSystem<F>> {
774+
match self {
775+
Self::CS(a) => Rc::try_unwrap(a).ok().map(|s| s.into_inner()),
776+
Self::None => None,
777+
}
778+
}
779+
770780
/// Obtain an immutable reference to the underlying `ConstraintSystem`.
771781
///
772782
/// # Panics

0 commit comments

Comments
 (0)