prog1 1.0.0

Execute a block after computing a result.
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 14.32 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 986.71 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fiveop

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 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);
}

Copyright

Copyright 2016 Philipp Matthias Schaefer philipp.matthias.schaefer@posteo.de

Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, modified, or distributed except according to those terms.