const_non_empty_str

Macro const_non_empty_str 

Source
macro_rules! const_non_empty_str {
    ($string: expr) => { ... };
}
Expand description

Similar to non_empty_str! but for const contexts.

Note that the provided expression must be const-evaluatable, else the compilation will fail.

§Examples

use non_empty_str::const_non_empty_str;

let message = const_non_empty_str!("Hello, world!");

Failing compilation on empty strings:

use non_empty_str::const_non_empty_str;

let never = const_non_empty_str!("");