SpacetimeDB
SpacetimeDB copied to clipboard
Implemented type-safe primary keys
Description of Changes
- Note: based on (and includes) #2957.
For a table like this:
#[table]
struct User {
#[primary_key]
id: Identity
}
generates a type like that:
#[allow(dead_code)]
#[derive(SpacetimeType)]
struct UserId(Identity);
impl std::borrow::Borrow<Identity> for UserId {
fn borrow(&self) -> &Identity {
&self.0
}
}
Yet to make it treat the type as Identity. Perhaps a trait is needed instead of a newtype.
- Resolves #3472.
API and ABI breaking changes
TBD.
Expected complexity level and risk
TBD.
Testing
- [x] Module compiles
- [ ] Module publishes