lazy_attribute_core/
lib.rs

1//! This crate provides the `#[lazy_ref]` attribute to lazily evaluate functions.
2//!
3//! This crate is not meant to be used directly. Instead, you should use the [`lazy-attribute`](https://crates.io/crates/lazy-attribute) crate.
4
5mod lazy;
6
7use proc_macro::TokenStream;
8
9//--------------------------------------------------------------------------------------------------
10// Attribute Procedural Macros
11//--------------------------------------------------------------------------------------------------
12
13#[proc_macro_attribute]
14pub fn lazy_ref(_attr: TokenStream, item: TokenStream) -> TokenStream {
15    let fn_syntax = syn::parse_macro_input!(item as syn::ItemFn);
16    lazy::expand(fn_syntax).into()
17}