assert_not_empty

Macro assert_not_empty 

Source
macro_rules! assert_not_empty {
    ($a:expr $(,)?) => { ... };
    ($a:expr, $($message:tt)+) => { ... };
}
Expand description

Assert an expression (such as a string or array) is not empty.

Pseudocode:
¬ a.is_empty()

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;

let a = "alfa";
assert_not_empty!(a);

// This will panic
let a = "";
assert_not_empty!(a);
// assertion failed: `assert_not_empty!(a)`
// https://docs.rs/assertables/…/assertables/macro.assert_not_empty.html
//  label: `a`,
//  debug: `\"\"`

§Module macros