godot-rust / godot-rust/gdext

`GodotConvert` derive-macro and `godot(transparent)` with `PhantomData`

Open
#1,563 2 comments 1 reaction 0 assignees View on GitHub
c: register quality-of-life
Dominant language
Rust
Stars
5.2k
Forks
312
Avg merge
12h 16m
Merged PRs (30d)
11

Description

It should be possible to derive `GodotConvert` with `godot(transparent)` on structs that have `PhantomData` and generics.

For example:

```rs
#[derive(GodotConvert)]
#[godot(transparent)]
pub struct Id(u32, PhantomData);
```

This struct is basically a newtype around `u32` with some extra rust typing, and so it makes sense that this should be representable in Godot.

Contributor guide

Open the contributing guide

Research direction

Start at the GodotConvert derive macro and inspect how godot(transparent) handles generic structs and PhantomData. Use the Id example from the issue as the reproduction case; the work is done when this declaration derives successfully and represents the u32 value in Godot.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, game-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.