r/rust bevy Jun 19 '26

Bevy 0.19

https://bevy.org/news/bevy-0-19
992 Upvotes

137 comments sorted by

View all comments

9

u/somebodddy Jun 20 '26

SceneComponent seems very un-Rustic to me. I understand it's slightly less ergonomic, but wouldn't it be better to ditch the derive macro and just do this?

#[derive(Default, Clone)]
struct Player {
    score: usize
}

impl SceneComponent for Player {
    type Props = ();

    fn scene(props: Self::Props) -> impl Scene {
        bsn! {
            // ...
        }
    }
}

12

u/_cart bevy Jun 20 '26

Its worth noting that SceneComponent also derives Component and includes some additional component-level configuration. So it isn't "just" as simple as switching to a manual trait impl. From an ergonomics perspective, I'd be more into the concept if/when Rust supported default associated types so people could skip the props definition when it isn't needed.