Request Details

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`:
  1. @bfops i think this is a real high priority for me a for others. NewType is a excellent way to organize the code and give meaning for ambiguous number types. can be set as HIGH priority.

  2. Hey @corrm, this is unchanged. This hasn't been a high priority for us since there's a fairly trivial workaround.

    If it's a high priority for you, I recommend filing it via our feature requests page. Then other users will have an easier time finding and upvoting.

  3. @bfops state of this feature?

  4. Centril added the enhancement label Feb 4, 2026
  5. Centril added the backward-compatible label Feb 4, 2026
  6. Centril added the feature-request label Feb 4, 2026
  7. Hi @CorrM, the full implementation of this feature is larger than a small PR.

    In the meantime, does a struct with a single named field work for you?

    if you mean something like that, Yes:

    #[derive(SpacetimeType)]
    struct SomeTable {
        value: u64
    }
    
  8. Hi @CorrM, the full implementation of this feature is larger than a small PR.

    In the meantime, does a struct with a single named field work for you?

  9. @bfops any update?

  10. Hey @CorrM, yes as @egormanga pointed out, this is not currently supported.

  11. @CorrM That's just for usecase illustration purposes. No type will work that way without my patch, and at least some do with it.

  12. I think best way to do it as a first step is to support the same currently supported(Column Types) types as underlying type.

    Your example from PR:

    #[derive(SpacetimeType)]
    pub struct Position(vecmath::Vector3<f64>);
    

    afaik if the underlying type are not derive Serialize, Deserialize no thing will work

Reopen this request?

The request will return to its prior live status.

Mark as Duplicate

Pick the request that Add Rust NewType Support is a duplicate of. Energy rolls up into that request and GitHub closes the linked issue as a duplicate with a timeline reference to the canonical.

Unmark Duplicate

Restore as an independent request. The linked GitHub issue will be reopened and its duplicate-of relationship cleared. The original timeline entries stay as history; the note below is posted as a follow-up comment.