(module: &ModuleDef, visibility: CodegenVisibility, out: &mut Indenter)
| 1505 | } |
| 1506 | |
| 1507 | fn print_applied_diff_defn(module: &ModuleDef, visibility: CodegenVisibility, out: &mut Indenter) { |
| 1508 | writeln!(out, "#[derive(Default)]"); |
| 1509 | writeln!(out, "#[allow(non_snake_case)]"); |
| 1510 | writeln!(out, "#[doc(hidden)]"); |
| 1511 | out.delimited_block( |
| 1512 | "pub struct AppliedDiff<'r> {", |
| 1513 | |out| { |
| 1514 | for (_, accessor_name, product_type_ref) in iter_table_names_and_types(module, visibility) { |
| 1515 | writeln!( |
| 1516 | out, |
| 1517 | "{}: __sdk::TableAppliedDiff<'r, {}>,", |
| 1518 | table_method_name(accessor_name), |
| 1519 | type_ref_name(module, product_type_ref), |
| 1520 | ); |
| 1521 | } |
| 1522 | // Also write a `PhantomData` field which uses the lifetime `r`, |
| 1523 | // in case the module defines zero tables, |
| 1524 | // as unused lifetime params are an error. |
| 1525 | writeln!(out, "__unused: std::marker::PhantomData<&'r ()>,",); |
| 1526 | }, |
| 1527 | "}\n", |
| 1528 | ); |
| 1529 | |
| 1530 | out.newline(); |
| 1531 | |
| 1532 | writeln!( |
| 1533 | out, |
| 1534 | " |
| 1535 | impl __sdk::InModule for AppliedDiff<'_> {{ |
| 1536 | type Module = RemoteModule; |
| 1537 | }} |
| 1538 | ", |
| 1539 | ); |
| 1540 | |
| 1541 | out.delimited_block( |
| 1542 | "impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> {", |
| 1543 | |out| { |
| 1544 | out.delimited_block( |
| 1545 | "fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::DbCallbacks<RemoteModule>) {", |
| 1546 | |out| { |
| 1547 | for (name, accessor_name, product_type_ref) in iter_table_names_and_types(module, visibility) { |
| 1548 | writeln!( |
| 1549 | out, |
| 1550 | "callbacks.invoke_table_row_callbacks::<{}>({:?}, &self.{}, event);", |
| 1551 | type_ref_name(module, product_type_ref), |
| 1552 | name.deref(), |
| 1553 | table_method_name(accessor_name), |
| 1554 | ); |
| 1555 | } |
| 1556 | }, |
| 1557 | "}\n", |
| 1558 | ); |
| 1559 | }, |
| 1560 | "}\n", |
| 1561 | ); |
| 1562 | } |
| 1563 | |
| 1564 | fn print_impl_spacetime_module(module: &ModuleDef, visibility: CodegenVisibility, out: &mut Indenter) { |
no test coverage detected
searching dependent graphs…