Skip to content

Require manual Component implementation - #458

Open
Ralith wants to merge 1 commit into
masterfrom
manual-component
Open

Ralith wants to merge 1 commit into
masterfrom
manual-component

Conversation

@Ralith

@Ralith Ralith commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Alternative to #454. This is a major breaking change for which I am seeking feedback. It is motivated by several user reports of difficult-to-diagnose errors, and general agreement that inserting foreign types as components is rare and not especially important.

@sanbox-irl

Copy link
Copy Markdown
Contributor

I implemented this in Fields of Mistria's engine and it + about a minute of adding derives to components, and we were done with no issues. It discovered no new bugs.

One minor issue however was components which had a type parameter(s). This isn't novel to this derive macro (clone has the same issue, for example), where:

#[derive(hecs::Component)]
pub struct Foo<T>(T);

only works when T: Component. That's the standard default and is fine, but it did require me to use my brain a bit to manually write a wrapper impl, which was the appropriate case here.

In any manner, it was a very successful test for us!

@Ralith

Ralith commented Sep 15, 2026

Copy link
Copy Markdown
Owner Author

Yeah, sometimes folks offer helper attributes to customize generated bounds, but it's so trivial to implement the trait that I think the simplicity of doing so with conventional syntax wins out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants