non_empty_str

Macro non_empty_str 

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

Constructs NonEmptyStr from the given string, panicking if the it is empty.

§Examples

Simple usage:

use non_empty_str::non_empty_str;

let nekit = non_empty_str!("nekit");

Panicking if the string is empty:

use non_empty_str::non_empty_str;

let never = non_empty_str!("");

Compilation failure when in const contexts:

use non_empty_str::non_empty_str;

let never = const { non_empty_str!("") };