-
Notifications
You must be signed in to change notification settings - Fork 0
Proof of concept of column names without touching stark-backend #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: upstream-main
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
|
|
||
| pub trait ColumnNames {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trait would have the column_name method
|
|
||
| pub trait ColumnNames {} | ||
|
|
||
| impl<T> ColumnNames for T {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently we implement it for all types just to prove the approach, but in practice this would be done for each air, as we currently do.
|
|
||
| impl<T> ColumnNames for T {} | ||
|
|
||
| pub trait AnyRapWithColumnNames<SC: StarkGenericConfig>: AnyRap<SC> + ColumnNames {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This extends the stark-backend trait with our ColumnNames trait
|
|
||
| pub trait AnyRapWithColumnNames<SC: StarkGenericConfig>: AnyRap<SC> + ColumnNames {} | ||
|
|
||
| pub type AirRefWithColumnNames<SC> = Arc<dyn AnyRapWithColumnNames<SC>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does the same for AirRef
|
|
||
| pub type AirRefWithColumnNames<SC> = Arc<dyn AnyRapWithColumnNames<SC>>; | ||
|
|
||
| impl<SC: StarkGenericConfig, R: AnyRap<SC> + ColumnNames> AnyRapWithColumnNames<SC> for R {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation would stay: if AnyRap and ColumnNames are implemented, then AnyRapWithColumnNames is implemented
| } | ||
|
|
||
| pub fn add_air<A: AnyRap<SC> + 'static>(&mut self, air: A) { | ||
| pub fn add_air<A: AnyRapWithColumnNames<SC> + 'static>(&mut self, air: A) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We replace all usages of AnyRap by our extension.
| }; | ||
| ( | ||
| global_airs[*air_id].clone(), | ||
| global_airs[*air_id].clone() as Arc<dyn AnyRap<_>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we need to reach into stark-backend, we lower to the original AnyRap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no other compile errors, so I suspect Rust is able to do this lowering automatically in other cases (for example, keygen)
No description provided.