prog1

Crates.ioprog1
lib.rsprog1
version1.0.0
sourcesrc
created_at2016-05-06 19:46:08.027023
updated_at2016-05-06 19:46:08.027023
descriptionExecute a block after computing a result.
homepage
repositoryhttps://github.com/fiveop/rust-prog1
max_upload_size
id4989
size14,178
Philipp Matthias Schäfer (fiveop)

documentation

README

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.

Commit count: 0

cargo fmt