Codegen: parameterize on a generated Context trait that contains external ctors/etors.

This commit is contained in:
Chris Fallin
2021-09-05 17:53:55 -07:00
parent 3ccbaf0f69
commit d725ac13b2
2 changed files with 110 additions and 11 deletions

View File

@@ -1,8 +1,12 @@
mod test;
pub fn get_input<C>(ctx: &mut C, x: u32) -> Option<(test::A,)> {
None
struct Context;
impl test::Context for Context {
fn get_input(&mut self, x: u32) -> Option<(test::A,)> {
Some((test::A::A1 { x: x + 1 },))
}
}
fn main() {}
mod test;
fn main() {
test::constructor_Lower(&mut Context, &test::A::A1 { x: 42 });
}