buildstructor
buildstructor copied to clipboard
Support free functions
Maybe we can support functions that are not on an impl
Alternative 1:
Directly on fn
outside of impl.
#[builder(entry="foo", exit="call")
fn do_foo(a: usize) {
...
}
Alternative 2:
Still require an impl. Allow derivation of proxy method:
#[buildstructor::buildstructor]
impl Foo {
#[builder(entry="foo", exit="call", proxy=true)
fn do_foo(a: usize) {
...
}
}
//Derived
fn foo() {
Foo::foo()
}
While using bevy_ecs
, I want to add entities that has different sets of components attached to them.
This means that what I'd ideally want, is a way to construct a builder, around a function, but the resulting struct should atleast derive(Bundle)
.
@CGMossa Could you elaborate a bit more? The final struct that a buildstructor builder spits out is not derived, it is the result of a constructor being called. Thus you can put derives on that struct no problem. Probably some code examples would help me understand.