ref_extended

Macro ref_extended 

Source
macro_rules! ref_extended {
    (|$(& $($var: ident)+ ),*| $body: expr) => { ... };
}
Expand description

Safely extends lifetime of reference as long as lifetime of it’s value.

§Usage

ref_extended(|&a| {}); // a is &'static u32 because lifetime of a's value is 'static

ref_extended(|&a, &mut b| {}); // a is &'static u32 and b is &'static mut u32 because lifetime of a and b' value is 'static