MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / print_impl_spacetime_module

Function print_impl_spacetime_module

crates/codegen/src/rust.rs:1564–1612  ·  view source on GitHub ↗
(module: &ModuleDef, visibility: CodegenVisibility, out: &mut Indenter)

Source from the content-addressed store, hash-verified

1562}
1563
1564fn print_impl_spacetime_module(module: &ModuleDef, visibility: CodegenVisibility, out: &mut Indenter) {
1565 out.delimited_block(
1566 "impl __sdk::SpacetimeModule for RemoteModule {",
1567 |out| {
1568 writeln!(
1569 out,
1570 "
1571type DbConnection = DbConnection;
1572type EventContext = EventContext;
1573type ReducerEventContext = ReducerEventContext;
1574type ProcedureEventContext = ProcedureEventContext;
1575type SubscriptionEventContext = SubscriptionEventContext;
1576type ErrorContext = ErrorContext;
1577type Reducer = Reducer;
1578type DbView = RemoteTables;
1579type Reducers = RemoteReducers;
1580type Procedures = RemoteProcedures;
1581type DbUpdate = DbUpdate;
1582type AppliedDiff<'r> = AppliedDiff<'r>;
1583type SubscriptionHandle = SubscriptionHandle;
1584type QueryBuilder = __sdk::QueryBuilder;
1585"
1586 );
1587 out.delimited_block(
1588 "fn register_tables(client_cache: &mut __sdk::ClientCache<Self>) {",
1589 |out| {
1590 for (_, accessor_name, _) in iter_table_names_and_types(module, visibility) {
1591 writeln!(
1592 out,
1593 "{}::register_table(client_cache);",
1594 table_module_name(accessor_name)
1595 );
1596 }
1597 },
1598 "}\n",
1599 );
1600 out.delimited_block(
1601 "const ALL_TABLE_NAMES: &'static [&'static str] = &[",
1602 |out| {
1603 for (name, _, _) in iter_table_names_and_types(module, visibility) {
1604 writeln!(out, "\"{name}\",");
1605 }
1606 },
1607 "];\n",
1608 );
1609 },
1610 "}\n",
1611 );
1612}
1613
1614fn print_const_db_context_types(out: &mut Indenter) {
1615 writeln!(

Callers 1

generate_global_filesMethod · 0.85

Calls 2

delimited_blockMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…