Skip to main content

Crate zyn_derive

Crate zyn_derive 

Source
Expand description

Procedural macros for the zyn framework.

Re-exported through the root zyn crate. All macros are accessed as zyn::zyn!, #[zyn::element], etc.

§Quick reference

// Template expansion
zyn::zyn! { fn {{ name | snake }}() {} }

// Reusable component
#[zyn::element]
fn my_getter(name: syn::Ident, ty: syn::Type) -> zyn::TokenStream { ... }

// Derive macro entry point
#[zyn::derive]
fn my_derive(
    #[zyn(input)] ident: zyn::Extract<zyn::syn::Ident>,
    #[zyn(input)] fields: zyn::Fields,
) -> zyn::TokenStream { ... }

// Typed attribute parsing
#[derive(zyn::Attribute)]
#[zyn("my_attr")]
struct MyAttr { skip: bool, rename: Option<String> }

Macros§

zyn
Expands a zyn template into a [proc_macro2::TokenStream].

Attribute Macros§

attribute
Defines an attribute macro entry point that auto-parses the annotated item into typed inputs.
derive
Defines a derive macro entry point that auto-parses DeriveInput into typed inputs.
element
Defines a reusable template component generating a struct that implements Render.
pipe
Defines a custom pipe transform used inside {{ expr | pipe }} interpolations.

Derive Macros§

Attribute
Derives typed attribute parsing from #[attr(...)] key-value syntax.