Macro tear::resume[][src]

macro_rules! resume {
    ( $($value:tt)* ) => { ... };
}

Dirty shortcut for creating a Looping::Resume

Description

The only argument is the value to wrap in Looping::Resume.

Used for writing short twist! statements that evaluate to a value. See examples.

Note that this macro will fail to compile if twist! can break with a value or when using twist -label.

Examples

use tear::{twist, resume};

let mut i = 0;
loop {
    i = twist! { resume!(7) };
    break;
}

let mut i = 0;
'a: loop {
    loop {
        i = twist! { -label 'a | resume!(2) };
        break 'a;
    }
}