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§

debug
Expands a zyn template with diagnostic output for debugging.
zyn
Expands a zyn template into a TokenStream.

Attribute Macros§

attribute
Defines an attribute macro entry point that auto-parses the annotated item into Input.
derive
Defines a derive macro entry point that auto-parses DeriveInput into Input.
element
Defines a reusable template component that generates a struct implementing Render.
pipe
Defines a custom pipe transform that generates a struct implementing Pipe.

Derive Macros§

Attribute
Derives the Attribute trait for typed attribute parsing from #[attr(...)] syntax.