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

#[entrait_impl] mod {} should just be replaced by an impl block #14

Closed
audunhalland opened this issue Aug 16, 2022 · 0 comments · Fixed by #15
Closed

#[entrait_impl] mod {} should just be replaced by an impl block #14

audunhalland opened this issue Aug 16, 2022 · 0 comments · Fixed by #15

Comments

@audunhalland
Copy link
Owner

audunhalland commented Aug 16, 2022

Instead of

#[entrait_impl]
mod some_mod {
    #[derive_impl(super::SomeTrait)]
    pub struct SomeType;
}

The macro should instead work with:

pub struct SomeType;

#[entrait_impl] // ?
impl SomeTrait for SomeType {
    fn foo(deps: &impl SomethingElse) {}
}

which would expand to:

impl SomeType { // <--- removed "SomeTrait for" from this location
    fn foo(deps: &impl SomethingElse) {}
}
impl<T> SomeTrait<T> for SomeType { // <--- move into this place
    fn foo(__impl: &Impl<T>) {
        Self::foo(__impl)
    }
}
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 a pull request may close this issue.

1 participant