#block #final #execute

final_fn

Simple final_fn macro, what executes given code when leaving code block

1 unstable release

0.1.0 Mar 4, 2023

#14 in #final

MIT license

5KB

final-fn

This crate provides final_fn macro, what executes given code when leaving code block.

Examples

use final_fn::final_fn;

fn main() {
    final_fn!(
        println!("End of main!")
    );
    
    println!("Hello world!");
}

You can also pass variables

use final_fn::final_fn;

fn main() {
    let x = 56;
    
    final_fn(
        println!("{x}")
    );
    
    println!("Hello world");
}

lib.rs:

Final_fn

This crate provides final_fn macros, what executes given code when leaving code block

Example

use final_fn::final_fn;

fn main() {
    final_fn!({
        println!("End of main!");
    });

    println!("Hello world!");
}

No runtime deps