-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new
Vec
type to frontend (#1103)
* Add Vec keyword * Add Vec to frontend * Add doc comments * Update noir_stdlib/src/collections/vec.nr Co-authored-by: Tom French <[email protected]> --------- Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
1fb2756
commit e125157
Showing
14 changed files
with
104 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod vec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
// These methods are all stubs currently and aren't implemented internally yet. | ||
// For a similar reason, no constructor for Vec is exposed yet since the type | ||
// is still in-progress. | ||
impl<T> Vec<T> { | ||
/// Get an element from the vector at the given index. | ||
/// Fails with a constraint error if the given index | ||
/// points beyond the end of the vector. | ||
#[builtin(vec_get)] | ||
fn get(_self: Self, _index: Field) -> T { } | ||
|
||
/// Push a new element to the end of the vector, returning a | ||
/// new vector with a length one greater than the | ||
/// original unmodified vector. | ||
#[builtin(vec_push)] | ||
fn push(_self: Self, _elem: T) -> Self { } | ||
|
||
/// Pop an element from the end of the given vector, returning | ||
/// a new vector with a length of one less than the given vector, | ||
/// as well as the popped element. | ||
/// Fails with a constraint error if the given vector's length is zero. | ||
#[builtin(vec_pop)] | ||
fn pop(_self: Self) -> (Self, T) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ mod sha512; | |
mod field; | ||
mod ec; | ||
mod unsafe; | ||
mod collections; | ||
|
||
#[builtin(println)] | ||
fn println<T>(_input : T) {} |