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

Consider add another way to support traits #110

Open
taiki-e opened this issue Sep 19, 2020 · 1 comment
Open

Consider add another way to support traits #110

taiki-e opened this issue Sep 19, 2020 · 1 comment
Labels
A-enum_derive Area: #[enum_derive] C-enhancement Category: A new feature or an improvement for an existing one

Comments

@taiki-e
Copy link
Owner

taiki-e commented Sep 19, 2020

Currently, we can use proc-macro-derive to extend the supported traits, but we can consider providing another way.

@taiki-e taiki-e added the A-enum_derive Area: #[enum_derive] label Sep 19, 2020
@taiki-e
Copy link
Owner Author

taiki-e commented Sep 19, 2020

ambassador is interesting. Maybe we can support something like the following:

#[delegatable_trait]
pub trait Trait {
    // ...
}

#[auto_enum(delegate(Trait))]
fn func() -> impl Trait {
    // ...
}

generate:

fn func() -> impl Trait {
    #[derive(::ambassador::Delegate)]
    #[delegate(Trait)]
    enum __Enum1<__T1, __T2> {
        __V1(__T1),
        __V2(__T2)
    }

    // ...
}

@taiki-e taiki-e added the C-enhancement Category: A new feature or an improvement for an existing one label Sep 21, 2020
@taiki-e taiki-e added this to the v0.8 milestone Dec 21, 2020
@taiki-e taiki-e removed this from the v0.8 milestone Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-enum_derive Area: #[enum_derive] C-enhancement Category: A new feature or an improvement for an existing one
Projects
None yet
Development

No branches or pull requests

1 participant