Skip to content

Add generics and lifetimes on element macro#17

Merged
aacebo merged 3 commits into
aacebo:mainfrom
supersurviveur:add-lifetimes-on-elements
Mar 13, 2026
Merged

Add generics and lifetimes on element macro#17
aacebo merged 3 commits into
aacebo:mainfrom
supersurviveur:add-lifetimes-on-elements

Conversation

@supersurviveur

@supersurviveur supersurviveur commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #15.

This PR adds lifetimes, generics and where clauses on the struct definition and trait implementation created with the zyn::element proc-macro attribute.

This allows doing the following code :

#[zyn::element]
fn generics<T: zyn::ToTokens>(children: T) -> zyn::TokenStream {
    zyn::quote::quote!(#children)
}
#[zyn::element]
fn lifetimes<'a>(ident: &'a zyn::syn::Ident) -> zyn::TokenStream {
    zyn::zyn!(struct {{ ident }};)
}

@aacebo aacebo left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for missing this, and thanks for the contribution!

@aacebo
aacebo merged commit 434fb79 into aacebo:main Mar 13, 2026
3 checks passed
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 this pull request may close these issues.

[Feature]: Add support for references in element arguments

2 participants