Macro lazyresult

Source
macro_rules! lazyresult {
    { move $($body:tt)* } => { ... };
    { $($body:tt)* } => { ... };
}
Expand description

Construct a value lazily, with the possibility for errors

Same as lazy! but force evaluates to a new Result each time, allowing force()? to work seamlessly; but since, currently, force consumes the captured closure when called the first time, your code has to avoid calling force again if it got an error (this is relying on the borrow checker being smart enough). Only the first force call can fail, subsequent ones always return Ok.