develop_debug 0.2.3

Print debugging information at development time
docs.rs failed to build develop_debug-0.2.3
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: develop_debug-0.6.1

Print debugging information at development time

What does this library do?

  • Print nice debugging information;
  • Does not affect performance in the release version;

Usage

Add this to your Cargo.toml :

[dependencies]
develop_debug = "0.2.3"

Use the develop_debug! :

use develop_debug::*;

// Standard usage
#[test]
fn use_develop_debug() {
    let x = "dear X";
    let say = "hello world!";
    let array = vec!["a", "b", "c"];
    let title2 = "balabala...";

    develop_debug!(title "example",title2);
    develop_debug!(step "do something...");
    develop_debug!(var x,say);
    develop_debug!(iter array.iter());
    develop_debug!(done "genius!");
    develop_debug!(error "dude, this road is blocked.");
    develop_debug!(
        "{}",
        "Use it just as you would with the `println!()` macro."
    );
}

// Using the shortcut, print the same result as above.
#[test]
fn use_develop_debug_shortcut() {
    let x = "dear X";
    let say = "hello world!";
    let array = vec!["a", "b", "c"];
    let title2 = "balabala...";

    dd___title!("example", title2);
    dd____step!("do something...");
    dd_____var!(x, say);
    dd____iter!(array.iter());
    dd____done!("genius!");
    dd___error!("dude, this road is blocked.");
    dd________!(
        "{}",
        "Use it just as you would with the `println!()` macro."
    );
}

Output in debug mode :

πŸ€  example
πŸ€  balabala...
πŸ¦€  do something...
πŸ”Ή  β€Ή   x   β€Ί = β€Ήdear Xβ€Ί
πŸ”Ή  β€Ή  say  β€Ί = β€Ήhello world!β€Ί
πŸ”Ά  array.iter()
πŸ”Έ  "a"
πŸ”Έ  "b"
πŸ”Έ  "c"
🌱  done.
🌱  genius!

πŸ’₯  error.
πŸ’₯  dude, this road is blocked.

🐰  Use it just as you would with the `println!()` macro.

No output in --release mode.

What are the benefits of develop_debug! shortcut?

😬 I think it's easy to recognize in the source code ;
🀀 I think it's convenient to prompt in VS Code ;
πŸ€“ I think it visually splits up the code ;

Does the develop_debug! macro affect code performance?

  • It doesn't affect code performance at all;
  • When compiled to the release, develop_debug! actually expanded to empty;

If the document is not semantically fluent

πŸ₯Ί, please forgive my lack of English. All the documents are explained by the translation software; If you can provide a better translation, please contact me at code@autodo.xyz;

I hope this simple library is of some help to you.

😌 😌 😌 😌 😌 😌