Derive Macro cucumber_codegen::World
source · [−]#[derive(World)]
{
// Attributes available to this derive:
#[world]
}
Expand description
Derive macro for implementing a World trait.
Example
#[derive(cucumber::World)]
#[world(init = Self::new)] // optional, uses `Default::default()` if omitted
struct World(usize);
impl World {
fn new() -> Self {
Self(42)
}
}Attribute arguments
-
#[world(init = path::to::fn)]Path to a function to be used for a
Worldinstance construction. Specified function can be either sync orasync, and either fallible (returnResult) or infallible (returnWorlditself). In case no function is specified, theDefault::default()will be used for construction.