Crate debug_et_diagnostics

Source
Expand description

set of macros and tools to colorfully debug and diagnose non-trivial code

Modules§

color

Macros§

admonition
colorfully prints an admonition
dbg
colorful alternative to std::dbg
filename
colofully prints the filename of the macro call
function_name
returns a String with the name of the function calling the macro
indent
indents an implementor of std::fmt::Display
indent_objdump
indents an implementor of std::fmt::Debug
info
colorfully prints an “INFO” admonition
location
colofully prints the “location” of the macro call (function name, filename and line number) in the code
step
colorfully steps through code
tag
colorfully wraps the given text in “<”, “>”: “<{text}>”
warn
colorfully prints a “WARN” admonition

Functions§

ansi
colorize the foreground and backrground of the given text and reset the colors afterwards
ansi_clear
clear the screen
auto
auto-colorize the given text with the color determined by from_display
back
colorize the backrground of the given text and reset afterwards
bg
colorize the background of the given text without resetting (ANSI 256 colors)
bgfg
colorize the foreground and backrground of the given text without resetting
couple
returns a tuple of (foreground, backrground) color by taking one unsigned integer, wrapping that around u8::MAX to determine the foreground color then uses invert_bw to determine the background color.
fg
colorize the foreground of the given text without resetting (ANSI 256 colors)
fore
colorize the foreground of the given text and reset afterwards
from_bytes
determine an ANSI-256 color determined by rgb_from_bytes
from_display
auto-colorize the underlying bytes of given text with the color determined by from_bytes
invert_bw
naive heuristic to return the brightest opposite of the given color.
pad_columns
pad text by the number of columns determined by term_cols
reset
reset the ANSI colors of the given test
rgb_from_bytes
simple and naive algorithm to determine a triple of RGB colors based on XOR’ing the given slice of bytes;
rgb_from_display
determine a triple of RGB colors of a string determined by rgb_from_bytes
term_cols
tries to obtain the number of columns of the terminal via [io_term_cols] and falls back to [DEFAULT_COLUMNS] in case of error.
wrap
wraps the given usize via remainder