Created
October 19, 2022 21:00
-
-
Save CarlKCarlK/c9859baac4a198a7d016f0d9b60c4bd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn count_statements() { | |
let mut stmt_counter = StmtCounter { count: 0 }; | |
let item_fn_old: ItemFn = parse_quote! { | |
fn hello() { | |
println!("hello world"); | |
{ | |
println!("hello solar system"); | |
println!("hello galaxy"); | |
} | |
} | |
}; | |
let item_fn_new = stmt_counter.fold_item_fn(item_fn_old); | |
println!("item_fn_new: {}", quote!(#item_fn_new)); | |
println!("count: {}", stmt_counter.count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment