macrofied-toolbox
This library provides an ergonomic experience of adding debugging messages to rust's
Result<T,E>
and Option<T>
patterns
Just like the cli-toolbox
crate, that the debug logic
resembles, this is not a logging alternative; it's intended to produce debugging output to be
used during application development.
Although the macros were designed to make debugging more ergonomic, they include variations that do not include debugging to provide coding consistency, so you have the option to use the same syntax consistently throughout your project.
Result<T,E>
use File;
use io;
use ;
use result;
Option<T>
use File;
use io;
use ;
use exit;
use option;
Resources
Usage
Each macro is gated by a feature; all
, option
or result
respectively.
option!
macro
[]
= { = "0.4", = ["option"] }
result!
macro
[]
= { = "0.4", = ["result"] }
Features
Although macrofied-toolbox
was designed to make adding debugging output more ergonomic,
the generation of debug output is gated by an optional X-debug
feature for maximum
flexibility.
* Debug output is only effective in unoptimized builds *
all-debug
- enables console debugging and both featuresoption-debug
- enables console debugging and theoption!
macroresult-debug
- enables console debugging and theresult!
macro
Roadmap
-
logging for both Ok<T> and Err<E> -
other patterns?
Implemented
-
result!
- handles aResult<T,E>
expression -
option!
- handles anOption<T>
expression - support reference/mutable
Ok<T>
andSome<T>
values