Expand description
Log your Result and Option chains with inline methods.
First, import all traits:
use logchop::*;This will extend Option and Result with new methods. Now
you can turn:
return match maybe_something {
Some(x) => Some(x),
None => {
debug!("Nothing found!");
None
}
}into
return maybe_something.debug_none("Nothing found!")๐๐ค
The full list of methods exposed are available on the respective types
Traitsยง
- Option
LogFormatter - Augment
Optiontypes with log methods that can print abitrary representations of wrapped values. If the type being wrapped implementsDebug, you may be able to useOptionLoggerinstead. - Option
Logger - Augment
Optiontypes with log methods that can printDebugrepresentations of wrapped values. If the type being logged does not implementDebug, useOptionLogFormatterinstead. - Result
LogFormatter - Augment
Resulttypes with log methods that can print abitrary representations of wrapped values. If the type being logged implementsDebug, you may be able to useResultLoggerinstead. - Result
Logger - Augment
Resulttypes with log methods that can print debug representations of wrapped values. If the wrappedOkorErrtypes do not implementDebug, useResultLogFormatterinstead.