Spotlight

Warning

Spotlight is currently considered experimental / alpha level quality

spotlight! is a drop in replacement macro for std::dbg! which adds additional information, has colored output, and can be called in a postfix position (e.g. between chaining method calls, as .spotlight("label")).

Screen Shot 2022-07-30 at 23 48 26

Examples

Note

The thread and function name are the same in these examples as they were taken from test runs, which name the main thread with the same name as the test function

Macro

```rust use spotlight::spotlight;

fn swap() { let mut left = 5; let mut right = 3; spotlight!(&left); spotlight!(&right); std::mem::swap(&mut left, &mut right); spotlight!(&left); spotlight!(&right); } ```

outputs

[time 1659217308153] [file tests/mod.rs:18] [fn mod::swap] [thread swap] [addr 0x16de8d350] &left = 5 [time 1659217308153] [file tests/mod.rs:19] [fn mod::swap] [thread swap] [addr 0x16de8d354] &right = 3 [time 1659217308153] [file tests/mod.rs:21] [fn mod::swap] [thread swap] [addr 0x16de8d350] &left = 3 [time 1659217308153] [file tests/mod.rs:22] [fn mod::swap] [thread swap] [addr 0x16de8d354] &right = 5

Method

```rust use spotlight::Spotlight;

fn method() { let _ = "test" .chars() .spotlight("aschars") .map(|char| char.touppercase().tostring()) .spotlight("mapped") .collect::() .spotlight("newstring"); } ```

outputs

[time 1659217480013] [thread method] [addr 0x16bc020d8] as_chars = Chars([ 't', 'e', 's', 't', ]) [time 1659217480014] [thread method] [addr 0x16bc01d68] mapped = Map { iter: Chars([ 't', 'e', 's', 't', ]), } [time 1659217480014] [thread method] [addr 0x16bc01d50] new_string = "TEST"

Prior Art