/// Perform the given operation with the current macro context fetched from TLS.
///
/// # Panics
///
/// This will panic if it's called outside of a macro context.
Perform the given operation with the current macro context fetched from TLS.
Perform the given operation with the current macro context fetched from TLS .
pub(crate) fn current_context<F, O>(f: F) -> O
where
    F: FnOnce(&MacroContext) -> O,
{
    MACRO_CONTEXT.with(|ctx| {
        let ctx = ctx
            .try_borrow()
            .expect("expected shared access to macro context");
        let ctx = ctx.as_ref().expect("missing macro context");
        f(ctx)
    })
}
pub ( crate ) fn current_context < F , O > ( f : F ) -> O where F : FnOnce ( & MacroContext ) -> O , { MACRO_CONTEXT . with ( | ctx | { let ctx = ctx . try_borrow ( ) . expect ( " " ) ; let ctx = ctx . as_ref ( ) . expect ( " " ) ; f ( ctx ) } ) }
Perform the given operation with the current macro context fetched from TLS.
Perform the given operation with the current macro context fetched from TLS .
f
F
panics
This will panic if it's called outside of a macro context.
This will panic if it ' s called outside of a macro context .