Skip to content

Question: is it possible to use paren inside a prefix? #2

@ajuvercr

Description

@ajuvercr

This crate looks super nice! But I have a question

I'm trying to do this

#[derive(Parse, Debug)]
struct Findable {
    #[prefix(kwd::findable)]
    #[paren]
    arg_paren: syn::token::Paren,
    #[prefix(kwd::ty in arg_paren)]
    #[prefix(syn::Token![=] in arg_paren)]
    #[inside(arg_paren)]
    ty: syn::Type,
}

It would seem logical to make it work like this

#[derive(Parse, Debug)]
struct Findable {
    #[prefix(kwd::findable)]
    #[prefix(syn::token::Paren as arg_paren)]
    #[prefix(kwd::ty in arg_paren)]
    #[prefix(syn::Token![=] in arg_paren)]
    #[inside(arg_paren)]
    ty: syn::Type,
}

Just because I don't want useless fields inside my struct :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions