clockworklabs / SpacetimeDB

Multiplayer at the speed of light
https://spacetimedb.com
Other
4.41k stars 110 forks source link

Rust SDK: group all codegen'd names exported from the SDK under `pub mod __codegen` #1900

Open gefjon opened 4 weeks ago

gefjon commented 4 weeks ago

Description of Changes

Based on #1897 . While writing that PR, I moved a definition from db_connection.rs to client_cache.rs. This needlessly broke codegen.

Rather than having the codegen rely on a whole bunch of different #[doc(hidden)] pub mods in the SDK library by path, group every name the codegen refers to under spacetimedb_sdk::__codegen. This has several benefits:

In a similar vein, the unstable interface Cloud use(s|d) to set its client address is moved to spacetimedb_sdk::unstable. This may end up getting removed anyways; I'm not sure what the plan is going forward for how cloud nodes will identify themselves.

API and ABI breaking changes

Breaks codegen. Minor user-facing breakage: u256, i256 are now re-exported from the SDK root rather than via the spacetimedb_sdk::sats::{u256, i256}. The sats crate is no longer fully re-exported, so users who want it will need a separate dependency.

Expected complexity level and risk

1

Testing