Crate prog1 [] [src]

Execute a block after computing a result.

This crate provides the macro prog1, an implementation of the homonymous Common Lisp macro.

It allows to compute a result, before executing a block that changes values previously used to compute the result.

Examples

#[macro_use]
extern crate prog1;

fn main() {
    let mut a = 0;

    assert_eq!(prog1!(a; { a += 1 }), 0);
    assert_eq!(a, 1);
}

Macros

prog1

Executes $after after computing the result $result.