with_let

Macro with_let 

Source
macro_rules! with_let {
    {
        [ ],
        { $($body:tt)* }
    } => { ... };
    {
        [ $bind0:ident = $val0:expr; $($bindn:tt)* ],
        { $($body:tt)* }
    } => { ... };
}
Expand description

Establish bindings, within a sub-expression

with_let!([
    BINDING = EXPRESSION;
    // .. more BINDINGs ...
], {
    BODY
});

Expands to a 1-arm match (the “match lifetime extension trick). Each subsequent BINDING may refer to previous ones.