Skip to content

Commit

Permalink
docs: Make calling function with generic parameters executable
Browse files Browse the repository at this point in the history
  • Loading branch information
e1Ru1o committed Jan 20, 2025
1 parent 1d3e277 commit 5351aa3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/docs/noir/concepts/generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,17 @@ fn main() {
// We can use first_element_is_equal for arrays of any type
// as long as we have an Eq impl for the types we pass in
let array = [MyStruct::new(), MyStruct::new()];
assert(array_eq(array, array, MyStruct::eq));
assert(first_element_is_equal(array, array));
}

struct MyStruct {
foo: Field
}

impl MyStruct {
fn new() -> Self {
MyStruct { foo: 0 }
}
}

impl Eq for MyStruct {
Expand Down

0 comments on commit 5351aa3

Please sign in to comment.