From 37cf1b1704f9ddd5ca54d5458f3e261cf45f9f9c Mon Sep 17 00:00:00 2001 From: moana Date: Mon, 16 Oct 2023 14:41:18 +0200 Subject: [PATCH] Update toolchain --- refactor_circuit.md | 51 --------------------------------------------- rust-toolchain | 2 +- 2 files changed, 1 insertion(+), 52 deletions(-) delete mode 100644 refactor_circuit.md diff --git a/refactor_circuit.md b/refactor_circuit.md deleted file mode 100644 index e694bd7e..00000000 --- a/refactor_circuit.md +++ /dev/null @@ -1,51 +0,0 @@ -Matteo's suggestion of restructuring the `Circuit` trait. - -1. Without the need to retain the private or public input values: -```rust -fn op(f: F, a: u32, b: u32) -> u32 where F: Fn(u32, u32) -> u32 { - f(a, b) -} - -fn add(a: u32, b: u32) -> u32 { - a + b -} - -fn mul(a: u32, b: u32) -> u32 { - a * b -} -``` - -2. With the option of retaining the private and public input values: -```rust -struct Foo where F: Fn(u32, u32) -> u32 { - a: u32, - b: u32, - callback: F -} - -impl Foo where F: Fn(u32, u32) -> u32 { - fn calc(&self) -> u32 { - (self.callback)(self.a, self.b) - } -} - -fn main() { - - let foo = Foo { - a: 10, - b: 20, - callback: add, - }; - - println!("add: {}", op(add, 10, 20)); - println!("mul: {}", op(mul, 10, 20)); - - println!("foo add: {}", foo.calc()); -} -``` - -Notes: -- The funcitons `add` and `mul` would be different circuit implementation, returning the size of the circuit. -- I wouldn't know how to search for the circuit implementation in the AST though. - -3. Another approach is the restructuring of the `Circuit` trait as proposed by Ed diff --git a/rust-toolchain b/rust-toolchain index fdd6c827..a46fa2f0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2022-09-14 +nightly-2023-08-24