Skip to content

Add Rust NewType Support #4031

@CorrM

Description

@CorrM

Is it supported already and im doing something wrong?

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, SpacetimeType)]
pub struct AccountId(pub u64);

#[table(name = account)]
pub struct Account {
    #[primary_key]
    #[auto_inc]
    pub id: AccountId,
    pub created_at: Timestamp,
}
1. proc-macro derive panicked
   message: called `Option::unwrap()` on a `None` value
2. proc-macro panicked: called `Option::unwrap()` on a `None` value

the trait bound `for<'de> schema::account::AccountId: spacetimedb::Deserialize<'de>` is not satisfied.
the column type `schema::account::AccountId` does not implement `SpacetimeType`
   table column types all must implement `SpacetimeType`
   if you own the type, try adding `#[derive(SpacetimeType)]` to its definition
   the following other types implement trait `spacetimedb::SpacetimeType`:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions