Expand description
set of macros and tools to colorfully debug and diagnose non-trivial code
Modules§
Macros§
- admonition
- colorfully prints an admonition
- dbg
- colorful alternative to std::dbg
- dbg_
byte - std::dbg equivalent for u8 which uses format_byte to display the byte
- dbg_
bytes - std::dbg equivalent for
&[u8]
which uses [format_bytes] to display the byte slice - dbg_
bytes_ if_ str - [std::dbg_bytes_str] equivalent which only displays debug message if the given bytes are valid UTF-8
- dbg_
bytes_ str - std::dbg equivalent for
&[u8]
which uses [format_bytes] to display the byte slice in base 16 and string - filename
- colofully prints the filename of the macro call
- format_
byte - colorfully formats a u8 as hex => binary => decimal (=> char (if ascii))
- format_
bytes - colorfully formats a slice or vector of u8 as hex => binary => decimal (=> char (if ascii))
- format_
bytes_ str - colorfully formats a slice or vector of u8 as hex
- format_
dbg - format_
dbg_ location - 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
- step_
dbg - colorfully steps through code debugging given expressions
- tag
- colorfully wraps the given text in “<”, “>”: “<{text}>”
- warn
- colorfully prints a “WARN” admonition
Constants§
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
- auto_
bright - brighter version of auto
- auto_
dark - darker version of auto
- 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
- bright
- return a brighter color near the given one via bright_rgb_band.
- bright_
rgb_ band - return a brighter color from the given rgb band
- byte
- auto-colorize the given byte with the color determined by from_byte
- byte_
bin - auto-colorize the given byte in bin format with the color determined by from_byte
- byte_
hex - auto-colorize the given byte in hex format with the color determined by from_byte
- 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.
- cube_
ansi_ 256 - dark
- return a darker color near the given one via dark_rgb_band.
- dark_
rgb_ band - return a darker color from the given rgb band
- fg
- colorize the foreground of the given text without resetting (ANSI 256 colors)
- fore
- colorize the foreground of the given text and reset afterwards
- format_
slice_ debug - format_
slice_ display - format_
slice_ hex - from_
byte - determine an ANSI-256 color determined by [
from_bytes(&[byte])
] - from_
bytes - determine an ANSI-256 color determined by rgb_from_bytes
- from_
debug - auto-colorize the underlying bytes of given text with the color determined by from_bytes
- from_
display - auto-colorize the underlying bytes of given text with the color determined by from_bytes
- get_
ansi_ rgb - invert_
ansi - converts the given color to rgb triple then inverts the rgb and converts back to ansi256
- invert_
bw - brings the color to grayscale then inverts it
- invert_
rgb - converts the given color to rgb triple then inverts the rgb and converts back to ansi256
- is_
bright_ rgb_ band - return true if the given rgb band is bright
- is_
dark_ rgb_ band - return true if the given rgb band is dark
- merge_
rgb - merges a sequence of slice
[u8; 3]
into a single slice[u8; 3]
- non_
zero_ be_ bytes - pad
- pad text
- pad_
columns - pad text by the number of columns determined by term_cols
- reset
- reset the ANSI colors of the given test
- rgb_
from_ byte - returns a
[red, green, blue]
slice[u8; 3]
from a single byte - 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
- rgb_
to_ byte - returns a
[red, green, blue]
slice[u8; 3]
from a single byte - term_
cols - tries to obtain the number of columns of the [DEFAULT_COLUMNS] in case of error.
- wrap
- wraps the given usize via remainder