develop_debug 0.1.0

Print debugging information at development time
Documentation

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 = { version = "0.1.0", features = ["debug"] }

Use the develop_debug! :

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!(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.");

Output:

๐Ÿ€  example
๐Ÿ€  balabala...
๐Ÿ”ท  โ€น   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.

Using the develop_debug! shortcut, print the same output as above :

use develop_debug::*;

let x = "dear X";
let say = "hello world!";
let array = vec!["a", "b", "c"];
let title2 = "balabala...";

dd___title!("example", title2);
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.");

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 ;

How do development debug macros affect the code in the release?

๐Ÿ˜ฌ Add this to your Cargo.toml when developing :

[dependencies]
develop_debug = { version = "0.1.0", features = ["debug"] }

๐Ÿค“ Modify Cargo.toml when you are ready to release :

[dependencies]
develop_debug = { version = "0.1.0" }
  • There is no need to clear debugging methods from source code;
  • The develop_debug! macro expands to empty;
  • It doesn't affect code performance at all;

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.

Some amazing mistakes are not mistakes

After switching features, then execute cargo to report an error:

cargo build
...
error: failed to remove .../target/debug/deps/generates-...: No such file or directory (os error 2)
# The solution
# Switch features, and then
# Clear old compiled content
# Execute the required command
cargo clean
cargo build