Macro final_fn::final_fn

source ·
macro_rules! final_fn {
    ($code:block) => { ... };
    ($code:expr) => { ... };
}
Expand description

How this macros works

This macros creates FinalFunc structure, what implements Drop trait

Examples

This short examples show, how to use this macros!

  • Code block
use final_fn::final_fn;

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

    println!("Hello world!");
}
  • Expression
use final_fn::final_fn;

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

    println!("Hello world!");
}