From 5e4b42627e7a46cb385aeb15b6ac46614ef6bf5b Mon Sep 17 00:00:00 2001 From: Tom French Date: Tue, 18 Apr 2023 14:55:02 +0100 Subject: [PATCH] feat: implement `FieldElement::from()` --- acir_field/src/generic_ark.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/acir_field/src/generic_ark.rs b/acir_field/src/generic_ark.rs index 378dbe347..68a6f1ea9 100644 --- a/acir_field/src/generic_ark.rs +++ b/acir_field/src/generic_ark.rs @@ -143,6 +143,16 @@ impl From for FieldElement { } } +impl From for FieldElement { + fn from(boolean: bool) -> FieldElement { + if boolean { + FieldElement::one() + } else { + FieldElement::zero() + } + } +} + impl FieldElement { pub fn one() -> FieldElement { FieldElement(F::one())