Macro chstr::chstr[][src]

macro_rules! chstr {
    [$($c : expr), * $(,) ?] => { ... };
}
Expand description

Converts a char array into a constant &str.

Examples

Basic usage:

const ABC: &str = chstr!['a', 'b', 'c'];

assert_eq!(ABC, "abc");

Directory separator:

const SEPARATOR_CHAR: char = std::path::MAIN_SEPARATOR;
const SEPARATOR: &str = chstr![SEPARATOR_CHAR];

let mut chars = SEPARATOR.chars();
assert_eq!(chars.next(), Some(SEPARATOR_CHAR));
assert_eq!(chars.next(), None);