Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple World fails #148

Closed
ghost opened this issue Oct 31, 2021 · 2 comments · Fixed by #150
Closed

Multiple World fails #148

ghost opened this issue Oct 31, 2021 · 2 comments · Fixed by #150
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ghost
Copy link

ghost commented Oct 31, 2021

Please add some gotchas or common pitfalls to docs.

FAILS conflicting implementation for CucumberThenRegexAsync

#[derive(Debug, WorldInit)]
pub struct AnimalWorld1 {
  
}

#[async_trait(?Send)]
impl World for AnimalWorld1 {
    type Error = Infallible;
    async fn new() -> Result<Self, Infallible> {
        Ok(Self {
       
        })
    }
}
#[derive(Debug, WorldInit)]
pub struct AnimalWorld2 {
  
}

#[async_trait(?Send)]
impl World for AnimalWorld2 {
    type Error = Infallible;
    async fn new() -> Result<Self, Infallible> {
        Ok(Self {
       
        })
    }
}
@ilslv ilslv added the bug Something isn't working label Nov 1, 2021
@ilslv ilslv self-assigned this Nov 1, 2021
@ilslv
Copy link
Member

ilslv commented Nov 1, 2021

@evergreen-trading-systems actually proc-macros where designed with this feature in mind. But WorldInit produces structs with the same names. Fixed and covered with tests to avoid regression in #150

For now you can place your World declarations in separate modules and re-export them

pub use self::{first::AnimalWorld1, second::AnimalWorld2};

pub mod first {
    #[derive(Debug, WorldInit)]
    pub struct AnimalWorld1;

    #[async_trait(?Send)]
    impl World for AnimalWorld1 {
        type Error = Infallible;
        async fn new() -> Result<Self, Infallible> {
            Ok(Self {
        
            })
        }
    }
}

pub mod second {
    #[derive(Debug, WorldInit)]
    pub struct AnimalWorld2;

    #[async_trait(?Send)]
    impl World for AnimalWorld2 {
        type Error = Infallible;
        async fn new() -> Result<Self, Infallible> {
            Ok(Self {
        
            })
        }
    }
}

@tyranron tyranron added this to the 0.10.2 milestone Nov 3, 2021
@tyranron
Copy link
Member

tyranron commented Nov 3, 2021

@evergreen-trading-systems fixed in #150 and released in 0.10.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants