whaterror
There is nothing at all in your return type, useful or otherwise.
Proc macro attribute for a more customizable alternative to the standard library's
Termination
trait.
As a simple example, this replicates the standard behavior for fn main()
returning
Result<T, E>
:
use whaterror;
If your handler returns, whaterror
will automatically exit with code 1 (or panic if inside a
test).
This also works for Option<T>
:
use whaterror;
The ||
isn't necessary in this case, since there are no arguments:
use whaterror;
This works for non-()
types just like you would expect. Non-main
functions are technically
allowed, but currently have very strict limitations.
These limitations are planned to be lifted in the future.