benri
Convenient macros wrapping the standard library.
This library provides convenient macros!() around std functionality.
Feature flags
| Flag | Purpose |
|---|---|
log |
Enable log usage in certain places |
Example 1 - Flip a bool:
let mut a = false;
flip!;
assert!;
flip!;
assert!;
Example 2 - Get the current Instant:
let now = now!;
sleep;
assert!;
Example 3 - Get elapsed Instant time:
let now = now!;
sleep;
assert!;
assert!;
assert!;
assert!;
assert!;
Example 4 - Sleep a thread:
let now = now!;
// This sleeps the current thread for 1 second.
sleep!;
assert!;
Example 5 - Exit all threads:
spawn.join.unwrap;
// The program will has already exited.
// The below statement will never be reached.
unsafe
Example 6 - Send/receive a channel message or mass_panic!():
This works with any channel (like crossbeam_channel) that
have the same method names as the std channels since the inner macro is calling .send() and .recv().
let = ;
spawn.join.unwrap;
assert!;