#[spawn]
Expand description
This marks a function as the method that should be used to create and spawn the actor. It must
return the type of the actor, either as Self
or by its name.
Arguments
This macro can be passed what to rename the method in the form of rename = "{new name}"
.
This is most useful when generating both a create and spawn method from the same constructor.
Usage
ⓘ
#[spaad::spawn]
fn new(some: Thing) -> MyActor {
MyActor { some }
}
#[spaad::spawn(rename = "something_else")] // Emits a method called `something_else`
fn spawn2(some: Thing) -> MyActor {
MyActor { some }
}