-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Hintable struct to support generics (#742)
- Loading branch information
1 parent
f5bac96
commit 09dad3b
Showing
6 changed files
with
62 additions
and
49 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,23 @@ | ||
use axvm_native_compiler::prelude::*; | ||
use axvm_native_compiler_derive::Hintable; | ||
use axvm_recursion::{hints::InnerVal, types::InnerConfig}; | ||
use p3_field::AbstractField; | ||
|
||
#[derive(Hintable)] | ||
struct TestStruct { | ||
a: usize, | ||
b: usize, | ||
c: usize, | ||
} | ||
|
||
#[test] | ||
fn test_macro() { | ||
let x = TestStruct { a: 1, b: 2, c: 3 }; | ||
let stream = axvm_recursion::hints::Hintable::<InnerConfig>::write(&x); | ||
assert_eq!( | ||
stream, | ||
[1, 2, 3] | ||
.map(|x| vec![InnerVal::from_canonical_usize(x)]) | ||
.to_vec() | ||
); | ||
} |