(&self, module: &ModuleDef, options: &CodegenOptions)
| 598 | } |
| 599 | |
| 600 | fn generate_global_files(&self, module: &ModuleDef, options: &CodegenOptions) -> Vec<OutputFile> { |
| 601 | let mut output = CodeIndenter::new(String::new(), INDENT); |
| 602 | let out = &mut output; |
| 603 | |
| 604 | print_file_header(out, true); |
| 605 | |
| 606 | out.newline(); |
| 607 | |
| 608 | // Declare `pub mod` for each of the files generated. |
| 609 | print_module_decls(module, options.visibility, out); |
| 610 | |
| 611 | out.newline(); |
| 612 | |
| 613 | // Re-export all the modules for the generated files. |
| 614 | print_module_reexports(module, options.visibility, out); |
| 615 | |
| 616 | out.newline(); |
| 617 | |
| 618 | // Define `enum Reducer`. |
| 619 | print_reducer_enum_defn(module, options.visibility, out); |
| 620 | |
| 621 | out.newline(); |
| 622 | |
| 623 | // Define `DbUpdate`. |
| 624 | print_db_update_defn(module, options.visibility, out); |
| 625 | |
| 626 | out.newline(); |
| 627 | |
| 628 | // Define `AppliedDiff`. |
| 629 | print_applied_diff_defn(module, options.visibility, out); |
| 630 | |
| 631 | out.newline(); |
| 632 | |
| 633 | // Define `RemoteModule`, `DbConnection`, `EventContext`, `RemoteTables`, |
| 634 | // `RemoteReducers`, `RemoteProcedures` and `SubscriptionHandle`. |
| 635 | // Note that these do not change based on the module. |
| 636 | print_const_db_context_types(out); |
| 637 | |
| 638 | out.newline(); |
| 639 | |
| 640 | // Implement `SpacetimeModule` for `RemoteModule`. |
| 641 | // This includes a method for initializing the tables in the client cache. |
| 642 | print_impl_spacetime_module(module, options.visibility, out); |
| 643 | |
| 644 | vec![OutputFile { |
| 645 | filename: "mod.rs".to_string(), |
| 646 | code: output.into_inner(), |
| 647 | }] |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | /// Implements `HasCols` for the given `AlgebraicTypeRef` struct type. |
nothing calls this directly
no test coverage detected