bevyengine / bevyengine/bevy

Implement various `Reflect` traits on `std` library types

Open
#10,824 1 comment 0 reactions 0 assignees View on GitHub
A-Reflection C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

Thanks so much for `bevy`! Its an awesome crate and ecosystem that is awesome to program with :)

## What problem does this solve or what need does it fill?

I am wanting to `#[derive(Reflect)]` on structs / enums with `std` library types, like `IpAddr`, in the same way I can derive them for primitive types like `u16` and `bool`.

## What solution would you like?

This code to just compile:

```rust
#[derive(bevy::prelude::Reflect)]
struct Foo {
bar: std::net::IpAddr,
bax: std::time::Duration,
}
```

So that I can do awesome things like:
`app.register_type::()`

## What alternative(s) have you considered?

I know no other way of actually being able to reflect these values, nor if it is even possible given that the fields are private. I do not want to resort to manually implementing `TypePath`, `Reflect` and `FromReflect` for wrapper types and using those everywhere, since my lack of knowledge in this area is too big a blocker to spend a few days experimenting.

## Additional context

This would allow me to edit std library types using `bevy_editor_pls`

Contributor guide

Open the contributing guide

Research direction

Start at the `Reflect` derive and `App::register_type::()` example, then trace how primitive types are supported. Check the handling needed for private-field standard-library types such as `IpAddr` and `Duration`; done means the example compiles and both types can be registered and edited through `bevy_editor_pls`.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.